<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create(cls, duration: Union['Duration', timedelta]) -> 'Duration': """Creates a Duration from datetime.timedelta if necessary"""

        if isinstance(duration, cls):
            return duration
        elif isinstance(duration, timedelta):
            duration_in_picos = duration.total_seconds() * 10**12
            return cls(picos=duration_in_picos)
        else:
            raise TypeError(
                'Only datetime.timedelta and cirq.Duration are supported.')