def load_key(algorithm, key_data):
    """Load a Key object from the given data."""
    if not algorithm.isalnum():
        msg = 'unknown signing algorithm: %s' % (algorithm,)
        raise ValueError(msg)
    try:
        key_class = globals()[algorithm + 'Key']
    except KeyError:
        msg = 'unknown signing algorithm: %s' % (algorithm,)
        raise ValueError(msg)
    return key_class(key_data)
