def METHOD_NAME(h):
    # HACK ideally we would not have to guess at the encoding of `h`
    # (when it is not unicode). Hopefully all byte strings that come
    # through here are encoded as UTF-8. If not, .decode() may blow up.
    return h if isinstance(h, (str, Promise)) else h.decode("utf-8")