def push(self, local, remote):
        """
        Push file or folder to the specified directory to the device

        Args:
            local: local file or folder to be copied to the device
            remote: destination on the device where the file will be copied

        Returns:
            The file path saved in the phone may be enclosed in quotation marks, eg. '"test\ file.txt"'

        Examples:

            >>> adb = device().adb
            >>> adb.push("test.txt", "/data/local/tmp")

            >>> new_name = adb.push("test space.txt", "/data/local/tmp")  # test the space in file name
            >>> print(new_name)
            "/data/local/tmp/test\ space.txt"
            >>> adb.shell("rm " + new_name)

            >>> adb.push("test_dir", "/sdcard/Android/data/com.test.package/files")
            >>> adb.push("test_dir", "/sdcard/Android/data/com.test.package/files/test_dir")

        """
        _, ext = os.path.splitext(remote)
        if ext:
            # The target path is a file
            dst_parent = os.path.dirname(remote)
        else:
            dst_parent = remote

        # If the target file already exists, delete it first to avoid overwrite failure
        src_filename = os.path.basename(local)
        _, src_ext = os.path.splitext(local)
        if src_ext:
            dst_path = f"{dst_parent}/{src_filename}"
        else:
            if src_filename == os.path.basename(remote):
                dst_path = remote
            else:
                dst_path = f"{dst_parent}/{src_filename}"
        try:
            self.shell(f"rm -r {dst_path}")
        except:
            pass

        # If the target folder has multiple levels that have never been created, try to create them
        try:
            self.shell(f"mkdir -p {dst_parent}")
        except:
            pass

        # Push the file to the tmp directory to avoid permission issues
        tmp_path = f"{TMP_PATH}/{src_filename}"
        try:
            self.cmd(["push", local, tmp_path])
        except:
            self.cmd(["push", local, dst_parent])
        else:
            try:
                if src_ext:
                    try:
                        self.shell(f'mv "{tmp_path}" "{remote}"')
                    except:
                        self.shell(f'mv "{tmp_path}" "{remote}"')
                else:
                    try:
                        self.shell(f'cp -frp "{tmp_path}/*" "{remote}"')
                    except:
                        self.shell(f'mv "{tmp_path}" "{remote}"')
            finally:
                try:
                    if TMP_PATH != dst_parent:
                        self.shell(f'rm -r "{tmp_path}"')
                except:
                    pass
        return dst_path

        Push file or folder to the specified directory to the device

        Args:
            local: local file or folder to be copied to the device
            remote: destination on the device where the file will be copied

        Returns:
            The file path saved in the phone may be enclosed in quotation marks, eg. '"test\ file.txt"'

        Examples:

            >>> adb = device().adb
            >>> adb.push("test.txt", "/data/local/tmp")

            >>> new_name = adb.push("test space.txt", "/data/local/tmp")  # test the space in file name
            >>> print(new_name)
            "/data/local/tmp/test\ space.txt"
            >>> adb.shell("rm " + new_name)

            >>> adb.push("test_dir", "/sdcard/Android/data/com.test.package/files")
            >>> adb.push("test_dir", "/sdcard/Android/data/com.test.package/files/test_dir")

        
airtest/core/android/adb.py