Convert hash to a function on pygit2