def reduce_endpoints(endpoints):
    '''return min and max of all endpoints'''
    first_endpoint = min(endpoints, key=lambda x: x[0])
    last_endpoint = max(endpoints, key=lambda x: x[1])
    return first_endpoint[0], last_endpoint[1]
return min and max of all endpoints
recipes/Python/577478_Search_nth_smallest_element_really_big/recipe-577478.py