<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def download_and_extract(uri, name, path):
 # type: (str, str, str) -> None """Download, prepare and install a compressed tar file from S3 or local directory as an entry point. SageMaker Python SDK saves the user provided entry points as compressed tar files in S3 Args: name (str):
 name of the entry point. uri (str):
 the location of the entry point. path (bool):
 The path where the script will be installed. It will not download and install the if the path already has the user entry point. """

    if not os.path.exists(path):
        os.makedirs(path)
    if not os.listdir(path):
        with tmpdir() as tmp:
            if uri.startswith('s3://'):
                dst = os.path.join(tmp, 'tar_file')
                s3_download(uri, dst)

                with tarfile.open(name=dst, mode='r:gz') as t:
                    t.extractall(path=path)

            elif os.path.isdir(uri):
                if uri == path:
                    return
                if os.path.exists(path):
                    shutil.rmtree(path)
                shutil.move(uri, path)
            else:
                shutil.copy2(uri, os.path.join(path, name))