def hash_params(params):
 if (isinstance(params, collections.Container) and (not isinstance(params, (text_type, binary_type)))):
  if isinstance(params, collections.Mapping):
   try:
    new_params = frozenset(params.items())
   except TypeError:
    new_params = set()
    for (k, v) in params.items():
     new_params.update((k, hash_params(v)))
    new_params = frozenset(new_params)
  elif isinstance(params, (collections.Set, collections.Sequence)):
   try:
    new_params = frozenset(params)
   except TypeError:
    new_params = set()
    for v in params:
     new_params.update(hash_params(v))
    new_params = frozenset(new_params)
  else:
   new_params = frozenset(params)
  return new_params
 return frozenset((params,))

def hash_params ( params ) : if ( isinstance ( params , collections . Container ) and ( not isinstance ( params , ( text_type , binary_type ) ) ) ) : if isinstance ( params , collections . Mapping ) : try : new_params = frozenset ( params . items ( ) ) except TypeError : new_params = set ( ) for ( k , v ) in params . items ( ) : new_params . update ( ( k , hash_params ( v ) ) ) new_params = frozenset ( new_params ) elif isinstance ( params , ( collections . Set , collections . Sequence ) ) : try : new_params = frozenset ( params ) except TypeError : new_params = set ( ) for v in params : new_params . update ( hash_params ( v ) ) new_params = frozenset ( new_params ) else : new_params = frozenset ( params ) return new_params return frozenset ( ( params , ) )
construct a data structure of parameters that is hashable .