<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def git_fetch(repo_dir, remote=None, refspec=None, verbose=False, tags=True):
 """Do a git fetch of `refspec` in `repo_dir`. If 'remote' is None, all remotes will be fetched. """

    command = ['git', 'fetch']
    if not remote:
        command.append('--all')
    else:
        remote = pipes.quote(remote)
    command.extend(['--update-head-ok'])
    if tags:
        command.append('--tags')
    if verbose:
        command.append('--verbose')
    if remote:
        command.append(remote)
    if refspec:
        command.append(refspec)
    return execute_git_command(command, repo_dir=repo_dir)