code: def fill_archive(self, stream=None, kind='tgz', prefix=None,
                       subrepos=False):
          
  
          allowed_kinds = settings.ARCHIVE_SPECS.keys()
          if kind not in allowed_kinds:
              raise ImproperArchiveTypeError('Archive kind not supported use one'
                  'of %s', allowed_kinds)
  
          if stream is None:
              raise VCSError('You need to pass in a valid stream for filling'
                             ' with archival data')
  
          if prefix is None:
              prefix = '%s-%s' % (self.repository.name, self.short_id)
          elif prefix.startswith('/'):
              raise VCSError("Prefix cannot start with leading slash")
          elif prefix.strip() == '':
              raise VCSError("Prefix cannot be empty")
  
          archival.archive(self.repository._repo, stream, self.raw_id,
                           kind, prefix=prefix, subrepos=subrepos)
  
          if stream.closed and hasattr(stream, 'name'):
              stream = open(stream.name, 'rb')
          elif hasattr(stream, 'mode') and 'r' not in stream.mode:
              stream = open(stream.name, 'rb')
          else:
              stream.seek(0)
docs: Fills up given stream.
  
          :param stream: file like object.
          :param kind: one of following: ``zip``, ``tgz`` or ``tbz2``.
              Default: ``tgz``.
          :param prefix: name of root directory in archive.
              Default is repository name and changeset's raw_id joined with dash
              (``repo-tip.<KIND>``).
          :param subrepos: include subrepos in this archive.
  
          :raise ImproperArchiveTypeError: If given kind is wrong.
          :raise VcsError: If given stream is None