<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find_tag(__matcher: str = 'v[0-9]*', *, strict: bool = True, git_dir: str = '.') -> str: """Find closest tag for a git repository. Note: This defaults to `Semantic Version`_ tag matching. Args: __matcher: Glob-style tag pattern to match strict: Allow commit-ish, if no tag found git_dir: Repository to search Returns: Matching tag name .. _Semantic Version: http://semver.org/ """

    command = 'git describe --abbrev=12 --dirty'.split()
    with chdir(git_dir):
        try:
            stdout = check_output(command + ['--match={}'.format(__matcher), ])
        except CalledProcessError:
            if strict:
                raise
            stdout = check_output(command + ['--always', ])

        stdout = stdout.decode('ascii', 'replace')
    return stdout.strip()