code: def omit_long_data(body, omit_len=512):
      
      if not isinstance(body, basestring):
          return body
  
      body_len = len(body)
      if body_len <= omit_len:
          return body
  
      omitted_body = body[0:omit_len]
  
      appendix_str = " ... OMITTED {} CHARACTORS ...".format(body_len - omit_len)
      if isinstance(body, bytes):
          appendix_str = appendix_str.encode("utf-8")
  
      return omitted_body + appendix_str
docs: omit too long str/bytes