def construct(key_data, algorithm=None):
<EOL>if not algorithm and isinstance(key_data, dict):<EOL><INDENT>algorithm = key_data.get('<STR_LIT>', None)<EOL><DEDENT>if not algorithm:<EOL><INDENT>raise JWKError('<STR_LIT>' % key_data)<EOL><DEDENT>key_class = get_key(algorithm)<EOL>if not key_class:<EOL><INDENT>raise JWKError('<STR_LIT>' % key_data)<EOL><DEDENT>return key_class(key_data, algorithm)<EOL>
Construct a Key object for the given algorithm with the given
key_data.