docs: def create(cls, bucket, key, _file_id=None, stream=None, mimetype=None,
                 version_id=None, **kwargs):
          """Create a new object in a bucket.
  
          The created object is by default created as a delete marker. You must
          use ``set_contents()`` or ``set_location()`` in order to change this.
  
          :param bucket: The bucket (instance or id) to create the object in.
          :param key: Key of object.
          :param _file_id: For internal use.
          :param stream: File-like stream object. Used to set content of object
              immediately after being created.
          :param mimetype: MIME type of the file object if it is known.
          :param kwargs: Keyword arguments passed to ``Object.set_contents()``.
          """
          bucket = as_bucket(bucket)
  
          if bucket.locked:
              raise BucketLockedError()
  
          with db.session.begin_nested():
              latest_obj = cls.query.filter(
                  cls.bucket == bucket, cls.key == key, cls.is_head.is_(True)
              ).one_or_none()
              if latest_obj is not None:
                  latest_obj.is_head = False
                  db.session.add(latest_obj)
  
              # By default objects are created in a deleted state (i.e.
              # file_id is null).
              obj = cls(
                  bucket=bucket,
                  key=key,
                  version_id=version_id or uuid.uuid4(),
                  is_head=True,
                  mimetype=mimetype,
              )
              if _file_id:
                  file_ = _file_id if isinstance(_file_id, FileInstance) else \
                      FileInstance.get(_file_id)
                  obj.set_file(file_)
              db.session.add(obj)
          if stream:
              obj.set_contents(stream, **kwargs)
          return obj