def _mytype(f, x):
 if (x not in f.free_symbols):
  return ()
 elif f.is_Function:
  return (type(f),)
 else:
  types = [_mytype(a, x) for a in f.args]
  res = []
  for t in types:
   res += list(t)
  res.sort()
  return tuple(res)

def _mytype ( f , x ) : if ( x not in f . free_symbols ) : return ( ) elif f . is_Function : return ( type ( f ) , ) else : types = [ _mytype ( a , x ) for a in f . args ] res = [ ] for t in types : res += list ( t ) res . sort ( ) return tuple ( res )
create a hashable entity describing the type of f .