'Get dynamic attributes to output format or do timescale conversion.'

def __getattr__(self, attr):

    if ((attr in self.SCALES) and (self.scale is not None)):
        cache = self.cache[u'scale']
        if (attr not in cache):
            if (attr == self.scale):
                tm = self
            else:
                tm = self.replicate()
                tm._set_scale(attr)
            cache[attr] = tm
        return cache[attr]
    elif (attr in self.FORMATS):
        cache = self.cache[u'format']
        if (attr not in cache):
            if (attr == self.format):
                tm = self
            else:
                tm = self.replicate(format=attr)
            value = tm._shaped_like_input(tm._time.to_value(parent=tm))
            cache[attr] = value
        return cache[attr]
    elif (attr in TIME_SCALES):
        if (self.scale is None):
            raise ScaleValueError(u'Cannot    convert    TimeDelta    with    undefined    scale    to    any    defined    scale.')
        else:
            raise ScaleValueError(u"Cannot    convert    {0}    with    scale    '{1}'    to    scale    '{2}'".format(self.__class__.__name__, self.scale, attr))
    else:
        return self.__getattribute__(attr)
