def to_id(string: str) -> str:
string = string.strip()<EOL>match = _URI_RE.match(string)<EOL>if match is None:<EOL><INDENT>match = _OPEN_RE.match(string)<EOL>if match is None:<EOL><INDENT>return string<EOL><DEDENT>else:<EOL><INDENT>return match.group(<NUM_LIT:2>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return match.group(<NUM_LIT:1>)<EOL><DEDENT>
Get a spotify ID from a URI or open.spotify URL.

    Paramters
    ---------
    string : str
        The string to operate on.

    Returns
    -------
    id : str
        The Spotify ID from the string.