code: def create_object(self, api, metadata=None):
          
          metadata = {k: v for k, v in (metadata or {}).items()}
          metadata.setdefault('creator', '{0.__name__} {0.__version__}'.format(pycdstar))
          metadata.setdefault('path', '%s' % self.path)
          metadata.update(self.add_metadata())
          bitstream_specs = [self] + self.add_bitstreams()
          obj = api.get_object()
          res = {}
          try:
              obj.metadata = metadata
              for file_ in bitstream_specs:
                  res[file_.bitstream_type] = file_.add_as_bitstream(obj)
          except:  # noqa: E722
              obj.delete()
              raise
          return obj, metadata, res
docs: Create an object using the CDSTAR API, with the file content as bitstream.
  
          :param api:
          :return: