code: def put_file(self, in_path, out_path):
          
          try:
              st = os.stat(in_path)
          except OSError as e:
              self._throw_io_error(e, in_path)
              raise
  
          if not stat.S_ISREG(st.st_mode):
              raise IOError('%r is not a regular file.' % (in_path,))
  
          # If the file is sufficiently small, just ship it in the argument list
          # rather than introducing an extra RTT for the child to request it from
          # FileService.
          if st.st_size <= self.SMALL_FILE_LIMIT:
              try:
                  fp = open(in_path, 'rb')
                  try:
                      s = fp.read(self.SMALL_FILE_LIMIT + 1)
                  finally:
                      fp.close()
              except OSError:
                  self._throw_io_error(e, in_path)
                  raise
  
              # Ensure did not grow during read.
              if len(s) == st.st_size:
                  return self.put_data(out_path, s, mode=st.st_mode,
                                       utimes=(st.st_atime, st.st_mtime))
  
          self._connect()
          self.parent.call_service(
              service_name='mitogen.service.FileService',
              method_name='register',
              path=mitogen.utils.cast(in_path)
          )
  
          # For now this must remain synchronous, as the action plug-in may have
          # passed us a temporary file to transfer. A future FileService could
          # maintain an LRU list of open file descriptors to keep the temporary
          # file alive, but that requires more work.
          self.get_chain().call(
              ansible_mitogen.target.transfer_file,
              context=self.parent,
              in_path=in_path,
              out_path=out_path
          )
docs: Implement put_file() by streamily transferring the file via
          FileService.
  
          :param str in_path:
              Local filesystem path to read.
          :param str out_path:
              Remote filesystem path to write.