def total_bouts(boutlist):
    """Takes list of times of bouts in seconds, returns number of total tape-directed bouts performed.
    Takes into account, that a 300 at the end signifies a full trial (ending time), not an actual bout.
    """
    if boutlist[-1] == 300:
        total_bouts = len(boutlist) - 1
    else:
        total_bouts = len(boutlist)
    return total_bouts