def in_nested_list(nested_list, obj):
 for elmt in nested_list:
  if isinstance(elmt, (list, tuple)):
   if in_nested_list(elmt, obj):
    return True
  elif (elmt == obj):
   return True
 return False

def in_nested_list ( nested_list , obj ) : for elmt in nested_list : if isinstance ( elmt , ( list , tuple ) ) : if in_nested_list ( elmt , obj ) : return True elif ( elmt == obj ) : return True return False
return true if the object is an element of <nested_list> or of a nested list .