def get_duration(s):
    """
    Calculate trip duration
    """
    pickup = s['tpep_pickup_datetime']
    dropoff = s['tpep_dropoff_datetime']
    if not all((pickup, dropoff)):
        return None
    duration_seconds = (dropoff - pickup).seconds
    return duration_seconds