<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def detect_id_type(sid):
 """Method that tries to infer the type of abstract ID. Parameters sid : str The ID of an abstract on Scopus. Raises ------ ValueError If the ID type cannot be inferred. Notes ----- PII usually has 17 chars, but in Scopus there are valid cases with only 16 for old converted articles. Scopus ID contains only digits, but it can have leading zeros. If ID with leading zeros is treated as a number, SyntaxError can occur, or the ID will be rendered invalid and the type will be misinterpreted. """

    sid = str(sid)
    if not sid.isnumeric():
        if sid.startswith('2-s2.0-'):
            id_type = 'eid'
        elif '/' in sid:
            id_type = 'doi'
        elif 16 <= len(sid) <= 17:
            id_type = 'pii'
    elif sid.isnumeric():
        if len(sid) < 10:
            id_type = 'pubmed_id'
        else:
            id_type = 'scopus_id'
    else:
        raise ValueError('ID type detection failed for \'{}\'.'.format(sid))
    return id_type