def is_str(obj):
    """
    Check if object is a string or bytes. On python 3, checking for string
    would be sufficient, but on python 2, it may not be.
    """
    return isinstance(obj, (bytes, str))