'Returns the type name if it\'s been defined
otherwise, it creates it from the class name'

@classmethod
def type_name(cls):

    if cls.__type_name__:
        type_name = cls.__type_name__.lower()
    else:
        camelcase = re.compile('([a-z])([A-Z])')
        ccase = (lambda s: camelcase.sub((lambda v: '{0}_{1}'.format(v.group(1), v.group(2))), s))
        type_name = ccase(cls.__name__)
        type_name = type_name[(-48):]
        type_name = type_name.lower()
        type_name = re.sub('^_+', '', type_name)
        cls.__type_name__ = type_name
    return type_name
