def make_force_push_mutate_refs_func(targets, sha):
    """Create a 'force push' function that will inform send_pack that we want
    to mark a certain list of target branches/tags to point to a particular
    git_sha.

    :param targets: List of branches/tags to point at the input sha
    :param sha: The git sha to point the branches/tags at
    :returns: A function to do the ref manipulation that a dulwich client can use"""
    def mutate_refs(refs):
        for target in targets:
            refs[target.encode('UTF-8')] = sha.encode('UTF-8')
        return refs
    return mutate_refs