def InsertObject(self, stream, url=None, bucket=None, obj=None):
    path = ''
    if url:
      path = Gcs.UrlToBucketAndNamePath(url)
    else:
      path = Gcs.MakeBucketAndNamePath(bucket, obj)
    with contextlib.closing(cloudstorage.open(path, 'w')) as obj:
      while True:
        buf = stream.read(self.READ_CHUNK_SIZE)
        if buf and len(buf):
          obj.write(buf)
        else:
          return
Writes a stream as the contents of an object in Gcs.
dataset/ETHPy150Open GoogleCloudPlatform/Data-Pipeline/app/src/clients/gcs.py/Gcs.InsertObject