def __new__(cls, value="0", context=None):
        if isinstance(value, basestring):
            if ':' in value:
                h, m = value.split(':')
                value = Decimal(h) + Decimal(m) * DEC2HOUR
        elif isinstance(value, datetime.timedelta):
            hours = 0
            if value.days != 0:
                hours += value.days * 24
                value = datetime.timedelta(seconds=value.seconds)
            a = str(value).split(':')[:2]
            hours += int(a[0])
            minutes = int(a[1])
            return cls('{0}:{1}'.format(hours, minutes))
            # return cls(':'.join(a))
        self = Decimal.__new__(Duration, value, context)
        return self
dataset/ETHPy150Open lsaffre/lino/lino/utils/quantities.py/Duration.__new__/original