def merge_valid_keys(params, valid_keys, extra):
 merged = {}
 if (not extra):
  return merged
 for key in valid_keys:
  if (key in extra):
   params[key] = extra[key]
   merged[key] = extra[key]
 return merged

def merge_valid_keys ( params , valid_keys , extra ) : merged = { } if ( not extra ) : return merged for key in valid_keys : if ( key in extra ) : params [ key ] = extra [ key ] merged [ key ] = extra [ key ] return merged
merge valid keys from extra into params dictionary and return dictionary with keys which have been merged .