code: def import_file(self, record, field, fname, fobj, event=None,
              return_format='json'):
          
          self._check_file_field(field)
          # load up payload
          pl = self.__basepl(content='file', format=return_format)
          # no format in this call
          del pl['format']
          pl['returnFormat'] = return_format
          pl['action'] = 'import'
          pl['field'] = field
          pl['record'] = record
          if event:
              pl['event'] = event
          file_kwargs = {'files': {'file': (fname, fobj)}}
          return self._call_api(pl, 'imp_file', **file_kwargs)[0]
docs: Import the contents of a file represented by fobj to a
          particular records field
  
          Parameters
          ----------
          record : str
              record ID
          field : str
              field name where the file will go
          fname : str
              file name visible in REDCap UI
          fobj : file object
              file object as returned by `open`
          event : str
              for longitudinal projects, specify the unique event here
          return_format : ('json'), 'csv', 'xml'
              format of error message
  
          Returns
          -------
          response :
              response from server as specified by ``return_format``