def UploadFile(self, file_path, file_type, _open=open):
    """Uploads a given log file to the server.

    Args:
      file_path: str, path of log file to upload.
      file_type: str, type of file being uploaded, like 'log'.
      _open: func, optional, default builtin open, to open file_path.
    """
    if os.path.isfile(file_path):
      logging.debug('UploadFile uploading file: %s', file_path)
      file_handle = _open(file_path, 'r')
      file_name = os.path.basename(file_path)
      url = '/uploadfile/%s/%s' % (file_type, file_name)
      try:
        self.Do('PUT', url, file_handle)
      finally:
        file_handle.close()
    else:
      logging.error('UploadFile file not found: %s', file_path)
dataset/ETHPy150Open google/simian/src/simian/client/client.py/SimianClient.UploadFile/original