docs: def encode(self, obj, host=None):
          """Encode an object using the serialisers available
          in this registry. Objects that have a type that is one of
          [dict, list, str, int, float, bool, tuple] are send back unchanged.
  
          A host-name can be given as an additional argument to identify the
          host in the resulting record if the encoder yields any filenames.
  
          This function only treats the object for one layer deep.
  
          :param obj:
              The object that needs encoding.
  
          :param host:
              The name of the encoding host.
          :type host: str
          """
          if obj is None:
              return None
  
          if type(obj) in [dict, list, str, int, float, bool]:
              return obj
  
          if isinstance(obj, RefObject):
              return obj.rec
  
          hook = self._hook(obj) if self._hook else None
          typename = hook if hook else '<object>'
          classname = object_name(type(obj))
  
          def make_rec(data, ref=None, files=None):
              rec = {'_noodles': noodles.__version__,
                     'type': typename,
                     'class': classname,
                     'data': data}
  
              if ref is not None:
                  rec['ref'] = ref
  
              if files:
                  rec['host'] = host
                  rec['files'] = files
  
              return rec
  
          if hook:
              return self._sers[hook].encode(obj, make_rec)
  
          enc = self[type(obj)]
          result = enc.encode(obj, make_rec)
          return result