def dict_keys_startswith(dictionary, string):
 matched_keys = [key for key in dictionary.keys() if key.startswith(string)]
 return dict(((k, dictionary[k]) for k in matched_keys))

def dict_keys_startswith ( dictionary , string ) : matched_keys = [ key for key in dictionary . keys ( ) if key . startswith ( string ) ] return dict ( ( ( k , dictionary [ k ] ) for k in matched_keys ) )
returns a dictionary containing the elements of <dict> whose keys start with <string> .