code: def encode_gen(line, encoding="utf-8"):
      
  
      for ele in line:
          if isinstance(ele, types.UnicodeType):
              yield ele.encode(encoding)
          else:
              yield ele
docs: Encodes all Unicode strings in line to encoding
  
      Parameters
      ----------
      line: Iterable of Unicode strings
      \tDate to be encoded
      encoding: String, defaults to "utf-8"
      \tTarget encoding