human
Complete this python program:
def initialize_decorator(init):
assistant
#Here is the Python code you requested.

    """Ensure that the length of string field do not exceed the limit.
    This decorator check the initialize arguments, to make sure the
    length of string field do not exceed the length limit, or raise a
    \StringLengthExceeded\ exception.
    Use decorator instead of inheritance, because the metaclass will
    check the __tablename__, primary key columns, etc. at the class
    definition.
    """
    def initialize(self, *args, **kwargs):
        cls = type(self)
        for (k, v) in kwargs.items():
            if hasattr(cls, k):
                attr = getattr(cls, k)
                if isinstance(attr, InstrumentedAttribute):
                    column = attr.property.columns[0]
                    if isinstance(column.type, String):
                        if (not isinstance(v, six.text_type)):
                            v = six.text_type(v)
                        if (column.type.length and (column.type.length < len(v))):
                            raise exception.StringLengthExceeded(string=v, type=k, length=column.type.length)
        init(self, *args, **kwargs)
    return initialize