def check_signature(signature):
    """ Checks if a given string is a signature (or at least if it is formatted as if it is).

    :param signature: Signature to be checked.
    :type signature: hex str
    :return: True if the signatures matches the format, raise exception otherwise.
    :rtype: bool
    """
    l = (len(signature[4:]) - 2) / 2
    if signature[:2] != '30':
        raise Exception('Wrong signature format.')
    elif int(signature[2:4], 16) != l:
        raise Exception('Wrong signature length ' + str(l))
    else:
        return True
