<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_license_file(data_dir):
 """Update NLPIR license file if it is out-of-date or missing. :param str data_dir: The NLPIR data directory that houses the license. :returns bool: Whether or not an update occurred. """

    license_file = os.path.join(data_dir, LICENSE_FILENAME)
    temp_dir = tempfile.mkdtemp()
    gh_license_filename = os.path.join(temp_dir, LICENSE_FILENAME)
    try:
        _, headers = urlretrieve(LICENSE_URL, gh_license_filename)
    except IOError as e:
        # Python 2 uses the unhelpful IOError for this. Re-raise as the more
        # appropriate URLError.
        raise URLError(e.strerror)

    with open(gh_license_filename, 'rb') as f:
        github_license = f.read()

    try:
        with open(license_file, 'rb') as f:
            current_license = f.read()
    except (IOError, OSError):
        current_license = b''

    github_digest = hashlib.sha256(github_license).hexdigest()
    current_digest = hashlib.sha256(current_license).hexdigest()

    if github_digest == current_digest:
        return False

    shutil.copyfile(gh_license_filename, license_file)
    shutil.rmtree(temp_dir, ignore_errors=True)
    return True