def PutPackage(self, filename, params, input_filename=None, input_file=None):
    """Put a package file contents.

    Read the documentation at
        https://cloud.google.com/
            appengine/docs/python/tools/webapp/blobstorehandlers

    for more information about why this method looks strange.  BlobStore
    upload requires a multipart/form POST to a dynamic URL.

    Args:
      filename: str, package filename
      params: dict of params to send with the request.
      input_filename: str, optional, filename to upload
      input_file: file, optional, file handle to read from
    Returns:
      str UUID for the uploaded payload
    Raises:
      Error: if input is invalid
      SimianServerError: if an error occured on the Simian server
      SimianClientError: if an error occured on the this client
    """
    if not input_file and not input_filename:
      raise Error('Must supply input_file or input_filename')

    # obtain the URL to POST to
    logging.debug('Getting POST URL....')
    post_url = self._SimianRequest('GET', URL_UPLOADPKG)
    logging.debug('Received POST URL: %s', post_url)
    (unused_scheme, netloc, path, unused_query, unused_fragment
    ) = urlparse.urlsplit(post_url)

    if netloc != self.netloc:
      raise SimianClientError(
          'Upload package URL is different host: %s (%s)' % (
              netloc, self.netloc))

    logging.debug('Uploading package...')
    # send the file contents
    post_url = path
    response = self._SimianFormUpload(
        post_url, filename, params,
        input_file=input_file, input_filename=input_filename)

    # upon success OR a controlled failure a redirect will occur
    redirect_url = response.headers.get('location', None)
    (unused_scheme, unused_netloc, path, query, unused_fragment
    ) = urlparse.urlsplit(redirect_url)
    redirect_url = '%s?%s' % (path, query)

    if not response.IsRedirect() or not redirect_url:
      # something happened which the server did not handle properly
      raise SimianClientError(
          (str(response) % 'Unexpected response from upload: %s'))

    # return the resulting blobstore ID
    result = self._SimianRequest('GET', redirect_url)
    return result
dataset/ETHPy150Open google/simian/src/simian/client/client.py/SimianClient.PutPackage/swapped operands of `%`