def prep_and_send(data, total_rotations):
    '\n    Calculates measurements (cups and gallons). Prepares the data into a database-friendly tuple. Appends that tuple to a list. \n    \n    It then tries to connect to database. If it is not successful then it does nothing but saves the data; it will try to send \n    the list of data-tuples the next time there is a water-flow event. \n    \n    Once the connection is successful data is emptied in commit_data().\n    '
    total_cups = (total_rotations / cup_movements)
    total_gallons = (total_cups / 16)
    total_liters = (total_gallons * 3.78541)
    now = datetime.datetime.now()
    print('{}: Movements: {}. \nCups: {}. \nGallons: {}. \nLiters: {}'.format(now, total_rotations, total_cups, total_gallons, total_liters))
    current_data = (now, round(total_rotations, 2), round(total_cups, 2), round(total_gallons, 2), round(total_liters, 2))
    data.append(current_data)
    print(f'datos: {data}')
    data = commit_data(data)
    return data
Calculates measurements (cups and gallons). Prepares the data into a database-friendly tuple. Appends that tuple to a list. 

It then tries to connect to database. If it is not successful then it does nothing but saves the data; it will try to send 
the list of data-tuples the next time there is a water-flow event. 

Once the connection is successful data is emptied in commit_data().
def prep_and_send(data, total_rotations):
    '\n    Calculates measurements (cups and gallons). Prepares the data into a database-friendly tuple. Appends that tuple to a list. \n    \n    It then tries to connect to database. If it is not successful then it does nothing but saves the data; it will try to send \n    the list of data-tuples the next time there is a water-flow event. \n    \n    Once the connection is successful data is emptied in commit_data().\n    '
    total_cups = (total_rotations / cup_movements)
    total_gallons = (total_cups / 16)
    total_liters = (total_gallons * 3.78541)
    now = datetime.datetime.now()
    print('{}: Movements: {}. \nCups: {}. \nGallons: {}. \nLiters: {}'.format(now, total_rotations, total_cups, total_gallons, total_liters))
    current_data = (now, round(total_rotations, 2), round(total_cups, 2), round(total_gallons, 2), round(total_liters, 2))
    data.append(current_data)
    print(f'datos: {data}')
    data = commit_data(data)
    return data