<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _seconds_or_timedelta(duration):
 """Returns `datetime.timedelta` object for the passed duration. Keyword Arguments: duration -- `datetime.timedelta` object or seconds in `int` format. """

    if isinstance(duration, int):
        dt_timedelta = timedelta(seconds=duration)
    elif isinstance(duration, timedelta):
        dt_timedelta = duration
    else:
        raise TypeError(
            'Expects argument as `datetime.timedelta` object '
            'or seconds in `int` format'
        )

    return dt_timedelta