docs: def upload(self, url=None, filepath=None, multipart=True, params=None, upload_processes=None, intelligent=False):
          """
          Uploads a file either through a local filepath or external_url.
          Uses multipart by default and Intelligent Ingestion by default (if enabled).
          You can specify the number of multipart processes and pass in parameters.
  
          returns [Filestack.Filelink]
          ```python
          from filestack import Client
  
          client = Client("<API_KEY>")
          filelink = client.upload(filepath='/path/to/file')
  
          # to use different storage:
          client = FilestackClient.new('API_KEY', storage='dropbox')
          filelink = client.upload(filepath='/path/to/file', params={'container': 'my-container'})
  
          # to use an external URL:
          filelink = client.upload(external_url='https://www.example.com')
  
          # to disable intelligent ingestion:
          filelink = client.upload(filepath='/path/to/file', intelligent=False)
          ```
          """
  
          if params:  # Check the structure of parameters
              STORE_SCHEMA.check(params)
  
          if filepath and url:  # Raise an error for using both filepath and external url
              raise ValueError("Cannot upload file and external url at the same time")
  
          if filepath:  # Uploading from local drive
              if intelligent:
                  response = intelligent_ingestion.upload(
                      self.apikey, filepath, self.storage, params=params, security=self.security
                  )
  
              elif multipart:
                  response = upload_utils.multipart_upload(
                      self.apikey, filepath, self.storage,
                      upload_processes=upload_processes, params=params, security=self.security
                  )
                  handle = response['handle']
                  return filestack.models.Filelink(handle, apikey=self.apikey, security=self.security)
  
              else:  # Uploading with multipart=False
                  filename = os.path.basename(filepath)
                  mimetype = mimetypes.guess_type(filepath)[0]
                  files = {'fileUpload': (filename, open(filepath, 'rb'), mimetype)}
  
                  if params:
                      params['key'] = self.apikey
                  else:
                      params = {'key': self.apikey}
  
                  path = '{path}/{storage}'.format(path=STORE_PATH, storage=self.storage)
  
                  if self.security:
                      path = "{path}?policy={policy}&signature={signature}".format(
                          path=path, policy=self.security['policy'].decode('utf-8'),
                          signature=self.security['signature']
                      )
  
                  response = utils.make_call(
                      API_URL, 'post', path=path, params=params, files=files
                  )
  
          else:  # Uploading from an external URL
              tasks = []
              request_url_list = []
  
              if utils.store_params_checker(params):
                  store_task = utils.store_params_maker(params)
                  tasks.append(store_task)
  
              if self.security:
                  tasks.append(
                      'security=p:{policy},s:{signature}'.format(
                          policy=self.security['policy'].decode('utf-8'),
                          signature=self.security['signature']
                      )
                  )
  
              tasks = '/'.join(tasks)
  
              if tasks:
                  request_url_list.extend((CDN_URL, self.apikey, tasks, url))
              else:
                  request_url_list.extend((CDN_URL, self.apikey, url))
  
              request_url = '/'.join(request_url_list)
  
              response = requests.post(request_url, headers=HEADERS)
  
          if response.ok:
              response = response.json()
              handle = re.match(
                  r'(?:https:\/\/cdn\.filestackcontent\.com\/)(\w+)',
                  response['url']
              ).group(1)
              return filestack.models.Filelink(handle, apikey=self.apikey, security=self.security)
          else:
              raise Exception('Invalid API response')