def get_key_for_purpose_and_type(self, purpose, key_type):
key = [key for key in self.keys.values() if key.purpose == purpose and key.key_type == key_type]<EOL>try:<EOL><INDENT>return key[<NUM_LIT:0>]<EOL><DEDENT>except IndexError:<EOL><INDENT>return None<EOL><DEDENT>
Gets a list of keys that match the purpose and key_type, and returns the first key in that list
Note, if there are many keys that match the criteria, the one you get back will be random from that list
:returns: A key object that matches the criteria