code: def attach_file(self, filename, resource_id=None):
          
          # Use file base name as resource identifier if none given
          if resource_id is None:
              resource_id = os.path.basename(filename)
          # Need to append resource identifier to base attachment Url
          upload_url = self.links[REF_MODEL_RUN_ATTACHMENTS] + '/' + resource_id
          # Upload model output
          response = requests.post(
              upload_url,
              files={'file': open(filename, 'rb')}
          )
          if response.status_code != 200:
              try:
                  raise ValueError(json.loads(response.text)['message'])
              except KeyError as ex:
                  raise ValueError('invalid state change: ' + str(response.text))
          # Returned refreshed verion of the handle
          return self.refresh()
docs: Upload an attachment for the model run.
  
          Paramerers
          ----------
          filename : string
              Path to uploaded file
  
          resource_id : string
              Identifier of the attachment. If None, the filename will be used as
              resource identifier.
  
          Returns
          -------
          ModelRunHandle
              Refreshed run handle.