def imt(token, i=None, m=None, t=None):
 clss = i
 types = ([t] if (t and (not isinstance(t, list))) else t)
 mpatterns = ([m] if (m and (not isinstance(m, list))) else m)
 if (token is None):
  return False
 elif (clss and isinstance(token, clss)):
  return True
 elif (mpatterns and any((token.match(*pattern) for pattern in mpatterns))):
  return True
 elif (types and any([(token.ttype in ttype) for ttype in types])):
  return True
 else:
  return False

def imt ( token , i = None , m = None , t = None ) : clss = i types = ( [ t ] if ( t and ( not isinstance ( t , list ) ) ) else t ) mpatterns = ( [ m ] if ( m and ( not isinstance ( m , list ) ) ) else m ) if ( token is None ) : return False elif ( clss and isinstance ( token , clss ) ) : return True elif ( mpatterns and any ( ( token . match ( * pattern ) for pattern in mpatterns ) ) ) : return True elif ( types and any ( [ ( token . ttype in ttype ) for ttype in types ] ) ) : return True else : return False
helper function to simplify comparisons instance .