def is_sorted(values, ascending=True):
    """Return True if a sequence is sorted"""

    for i, j in zip(values, values[1:]):

        if ascending and i > j:
            return False

        if not ascending and i < j:
            return False

    return True