<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_ls_remote(repo_dir, remote='origin', refs=None):
 """Run git ls-remote. 'remote' can be a remote ref in a local repo, e.g. origin, or url of a remote repository. Return format: .. code-block:: python {<ref1>: <commit_hash1>, <ref2>: <commit_hash2>, <refN>: <commit_hashN>, } """

    command = ['git', 'ls-remote', pipes.quote(remote)]
    if refs:
        if isinstance(refs, list):
            command.extend(refs)
        else:
            command.append(refs)
    raw = execute_git_command(command, repo_dir=repo_dir).splitlines()
    output = [l.strip() for l in raw if l.strip()
              and not l.strip().lower().startswith('from ')]
    return {ref: commit_hash for commit_hash, ref in
            [l.split(None, 1) for l in output]}