def validate(item, namespace='accounts', version=2, context=None):
    """Validate item against version schema.
    
    Args:
        item: data object
        namespace: backend namespace
        version: schema version
        context: schema context object
    """
    if namespace == 'accounts':
        if version == 2:
            schema = v2.AccountSchema(strict=True, context=context)
            return schema.load(item).data
        elif version == 1:
            return v1.AccountSchema(strict=True).load(item).data
        raise InvalidSWAGDataException('Schema version is not supported. Version: {}'.format(version))
    raise InvalidSWAGDataException('Namespace not supported. Namespace: {}'.format(namespace))
def validate ( item , namespace = 'accounts' , version = 2 , context = None ) : if namespace == 'accounts' : if version == 2 : schema = v2 . AccountSchema ( strict = True , context = context ) return schema . load ( item ) . data elif version == 1 : return v1 . AccountSchema ( strict = True ) . load ( item ) . data raise InvalidSWAGDataException ( 'Schema version is not supported. Version: {}' . format ( version ) ) raise InvalidSWAGDataException ( 'Namespace not supported. Namespace: {}' . format ( namespace ) )
Validate item against version schema.
    
    Args:
        item: data object
        namespace: backend namespace
        version: schema version
        context: schema context object