def message_from_str(src):
    """MessageString is a simple length restricted string:

    <xs:simpleType name="MessageString">
            <xs:restriction base="xs:string">
                    <xs:maxLength value="1024"/>
            </xs:restriction>
    </xs:simpleType>"""
    if len(src) > 1024:
        raise ValueError('MessageString exceeds 1024 characters: %s' % src)
    return src
