import re


def did_parse(did):
    """
    Parse a DID into it's parts.

    :param did: Asset did, str.
    :return: Python dictionary with the method and the id.
    """
    if not isinstance(did, str):
        raise TypeError(f'Expecting DID of string type, got {did} of {type(did)} type')

    match = re.match('^did:([a-z0-9]+):([a-zA-Z0-9-.]+)(.*)', did)
    if not match:
        raise ValueError(f'DID {did} does not seem to be valid.')

    result = {
        'method': match.group(1),
        'id': match.group(2),
    }

    return result