code: def flag_to_list(flagval, flagtype):
      
      if flagtype == 'int':
          return [int(_) for _ in flagval.split(',') if _]
  
      elif flagtype == 'float':
          return [float(_) for _ in flagval.split(',') if _]
  
      elif flagtype == 'str':
          return [_ for _ in flagval.split(',') if _]
  
      else:
          raise Exception("incorrect type")
docs: Convert a string of comma-separated tf flags to a list of values.