def ensure_unicode(_str, encoding="utf-8"):
    """ Simplify checking if passed in data are bytes or a string and decode
        bytes into unicode.

        Args:
            _str (str): The input string (possibly bytes)
            encoding (str): The encoding to use if input is bytes
        Returns:
            str: The encoded string
    """
    if isinstance(_str, bytes):
        return _str.decode(encoding)
    return _str