code: def upload(self, filename, configuration=None, metadata=None, transcript=None):
          
          data = {}
          if metadata:
              data['metadata'] = str(metadata)
          if configuration:
              data['configuration'] = str(configuration)
  
          # Determine mime type
          m = magic.Magic(mime=True)
          mime_type = m.from_file(filename)
  
          # Open file and pipe to request
          with open(filename) as handle:
              file_info = [('media', (filename, handle, mime_type))]
              rq = requests.Request(b'POST', self.full_url('base'), data=data, headers=self.session.headers,
                                    files=file_info)
              prepared_rq = rq.prepare()
              response = self.session.send(prepared_rq)
              response.raise_for_status()
          jsn = response.json()
          log.debug('Upload response: {}'.format(jsn))
          return VoicebaseMedia(jsn, api=self.api)
docs: Upload new new media to the service as an attachment or from a url.
          HTTP POST on /media
          :param filename: Media file attached to the request.
          :param configuration: VoicebaseMediaConfiguration
          :param metadata: VoicebaseMediaMeta
          :param transcript: attached transcript
          :return: VoicebaseMedia