code: def _dumps(obj, cls=pyjson.JSONEncoder):
      
  
      class WithBytes(cls):
          """
          JSON encoder that supports L{bytes}.
          """
  
          def default(self, o):
              if isinstance(o, bytes):
                  warnings.warn(
                      "Eliot will soon stop supporting encoding bytes in JSON"
                      " on Python 3", DeprecationWarning
                  )
                  return o.decode("utf-8")
              return cls.default(self, o)
  
      return pyjson.dumps(obj, cls=WithBytes).encode("utf-8")
docs: Encode to bytes, and presume bytes in inputs are UTF-8 encoded strings.