import re


def _extract_id(id_string):
    """Extracts the numeric ID from the representation of the subject or
    object ID that appears as an attribute of the svo element in the Medscan
    XML document.

    Parameters
    ----------
    id_string : str
        The ID representation that appears in the svo element in the XML
        document (example: ID{123})

    Returns
    -------
    id : str
        The numeric ID, extracted from the svo element's attribute
        (example: 123)
    """
    p = 'ID\\{([0-9]+)\\}'
    matches = re.match(p, id_string)
    assert(matches is not None)
    return matches.group(1)