code: def open_file(cls, filename: str, response: BaseResponse, mode='wb+'):
          '''Open a file object on to the Response Body.
  
          Args:
              filename: The path where the file is to be saved
              response: Response
              mode: The file mode
  
          This function will create the directories if not exist.
          '''
          _logger.debug('Saving file to {0}, mode={1}.',
                        filename, mode)
  
          dir_path = os.path.dirname(filename)
          if dir_path and not os.path.exists(dir_path):
              os.makedirs(dir_path)
  
          response.body = Body(open(filename, mode)f open_file(cls, filename: str, response: BaseResponse, mode='wb+'):
          '''Open a file object on to the Response Body.
  
          Args:
              filename: The path where the file is to be saved
              response: Response
              mode: The file mode
  
          This function will create the directories if not exist.
          '''
          _logger.debug('Saving file to {0}, mode={1}.',
                        filename, mode)
  
          dir_path = os.path.dirname(filename)
          if dir_path and not os.path.exists(dir_path):
              os.makedirs(dir_path)
  
          response.body = Body(open(filename, mode))
docs: Open a file object on to the Response Body.
  
          Args:
              filename: The path where the file is to be saved
              response: Response
              mode: The file mode
  
          This function will create the directories if not exist.