<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_root(directory):
 """Get root directory of the local git repo from any subdirectory within it. :raise GitError: If git command fails (dir not a git repo?). :param str directory: Subdirectory in the local repo. :return: Root directory of repository. :rtype: str """

    command = ['git', 'rev-parse', '--show-toplevel']
    try:
        output = run_command(directory, command, env_var=False)
    except CalledProcessError as exc:
        raise GitError('Failed to find local git repository root in {}.'.format(repr(directory)), exc.output)
    if IS_WINDOWS:
        output = output.replace('/', '\\')
    return output.strip()