def filter_by_key_prefix(dict, prefix):
 out_dict = {}
 for (key, value) in dict.items():
  if key.startswith(prefix):
   out_dict[key] = value
 return out_dict

def filter_by_key_prefix ( dict , prefix ) : out_dict = { } for ( key , value ) in dict . items ( ) : if key . startswith ( prefix ) : out_dict [ key ] = value return out_dict
return those and only those items in a dictionary whose keys have the given prefix .