<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def install(self, address, target_dir, select=[], fname=None):
 """ Install package. The command can be run only from DVC project root. E.g. Having: DVC package in https://github.com/dmpetrov/tag_classifier $ dvc pkg install https://github.com/dmpetrov/tag_classifier Result: tag_classifier package in dvc_mod/ directory """


    if not os.path.isdir(target_dir):
        raise DvcException(
            "target directory '{}' does not exist".format(target_dir)
        )

    curr_dir = os.path.realpath(os.curdir)
    if not os.path.realpath(target_dir).startswith(curr_dir):
        raise DvcException(
            "the current directory should be a subdirectory of the target "
            "dir '{}'".format(target_dir)
        )

    addresses = [address] if address else PackageManager.read_packages()
    for addr in addresses:
        mgr = PackageManager.get_package(addr)
        mgr.install_or_update(self, address, target_dir, select, fname)