def validateDid(did, method="dad"):
    """
    Parses and returns did and key string
    as a tuple (did, keystr)
    raises ValueError if fails parsing

    :param did: W3C DID string
    :param method: W3C did method string. Defaults to "dad".
    :return: (string, string) W3C DID string, key string
    """
    try:  # correct did format  pre:method:keystr
        pre, meth, keystr = did.split(":")
    except ValueError as ex:
        raise ValueError("Malformed DID value")

    if not pre or not meth or not keystr:  # check for empty values
        raise ValueError("Malformed DID value")

    if pre != "did" or meth != method:
        raise ValueError("Invalid DID value")

    return did, keystr