During the push phase, you can specify how you would like to update the refs in the remote repository.
E.g. (untested)::
from dulwich.client import get_transport_and_path
from dulwich.repo import Repo
repo = Repo(".")
client, path = get_transport_and_path("git+ssh://git@github.com/jelmer/foo")
def update_refs(refs):
refs["refs/heads/somebranch"] = repo["refs/heads/somebranch"].id
client.send_pack(path, update_refs, repo.object_store.generate_pack_data)