def Pull(self, device_filename, dest_file=None, timeout_ms=None, progress_callback=None):
        """Pull a file from the device.

        Args:
          device_filename: Filename on the device to pull.
          dest_file: If set, a filename or writable file-like object.
          timeout_ms: Expected timeout for any part of the pull.
          progress_callback: callback method that accepts filename, bytes_written and total_bytes,
                             total_bytes will be -1 for file-like objects

        Returns:
          The file data if dest_file is not set. Otherwise, True if the destination file exists
        """
        if not dest_file:
            dest_file = io.BytesIO()
        elif isinstance(dest_file, str):
            dest_file = open(dest_file, 'wb')
        elif isinstance(dest_file, file):
            pass
        else:
            raise ValueError("destfile is of unknown type")

        conn = self.protocol_handler.Open(
            self._handle, destination=b'sync:', timeout_ms=timeout_ms)

        self.filesync_handler.Pull(conn, device_filename, dest_file, progress_callback)

        conn.Close()
        if isinstance(dest_file, io.BytesIO):
            return dest_file.getvalue()
        else:
            dest_file.close()
            if hasattr(dest_file, 'name'):
                return os.path.exists(dest_file.name)
            # We don't know what the path is, so we just assume it exists.
            return True
Pull a file from the device.

        Args:
          device_filename: Filename on the device to pull.
          dest_file: If set, a filename or writable file-like object.
          timeout_ms: Expected timeout for any part of the pull.
          progress_callback: callback method that accepts filename, bytes_written and total_bytes,
                             total_bytes will be -1 for file-like objects

        Returns:
          The file data if dest_file is not set. Otherwise, True if the destination file exists
        
adb/adb_commands.py