def is_bytes(data):
    """
    Check if data is of type byte or bytearray.
    :param data:
    :return:
    """
    try:
        data = data.decode()
        return False
    except AttributeError:
        return True