def resource_auth(resource):
 resource_def = app.config['DOMAIN'][resource]
 if callable(resource_def['authentication']):
  resource_def['authentication'] = resource_def['authentication']()
 return resource_def['authentication']

def resource_auth ( resource ) : resource_def = app . config [ 'DOMAIN' ] [ resource ] if callable ( resource_def [ 'authentication' ] ) : resource_def [ 'authentication' ] = resource_def [ 'authentication' ] ( ) return resource_def [ 'authentication' ]
ensure resource auth is an instance and its state is preserved between calls .