def surrogate(text):
    """Returns unicode for a given RPM header.
    This is a layer to support both RPM 4.14 and 4.15.
    RPM 4.14 always returns bytes.
    RPM 4.15 always returns unicode strings with surrogateescaped errors.
    """
    if isinstance(text, bytes):
        return text.decode('utf-8', errors='surrogateescape')
    return text
