def duration_to_text(self, duration):
if isinstance(duration, tuple):<EOL><INDENT>start = (duration[<NUM_LIT:0>].strftime(self.ENTRY_DURATION_FORMAT)<EOL>if duration[<NUM_LIT:0>] is not None<EOL>else '<STR_LIT>')<EOL>end = (duration[<NUM_LIT:1>].strftime(self.ENTRY_DURATION_FORMAT)<EOL>if duration[<NUM_LIT:1>] is not None<EOL>else '<STR_LIT:?>')<EOL>duration = '<STR_LIT>' % (start, end)<EOL><DEDENT>else:<EOL><INDENT>duration = six.text_type(duration)<EOL><DEDENT>return duration<EOL>
Return the textual representation of the given `duration`. The duration can either be a tuple of
:class:`datetime.time` objects, or a simple number. The returned text will be either a hhmm-hhmm string (if the
given `duration` is a tuple) or a number.