<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def duration(label, stop_it=True, stop_at=None):
 """Returns duration in seconds for label"""


    if label not in labels:
        return None

    if "duration" in labels[label]:
        return Duration(labels[label]["duration"])

    if stop_it:
        return stop(label, at=stop_at)
    else:
        return None