def do_sort(
    environment, value, reverse=False, case_sensitive=False, attribute=None
):
    key_func = make_attrgetter(
        environment, attribute,
        postprocess=ignore_case if not case_sensitive else None
    )
    return sorted(value, key=key_func, reverse=reverse)