def register_yaml():
 try:
  import yaml
  registry.register('yaml', yaml.safe_dump, yaml.safe_load, content_type='application/x-yaml', content_encoding='utf-8')
 except ImportError:
  def not_available(*args, **kwargs):
   "In case a client receives a yaml message, but yaml\n            isn't installed."
   raise SerializerNotInstalled('No decoder installed for YAML. Install the PyYAML library')
  registry.register('yaml', None, not_available, 'application/x-yaml')

def register_yaml ( ) : try : import yaml registry . register ( 'yaml' , yaml . safe_dump , yaml . safe_load , content_type = 'application/x-yaml' , content_encoding = 'utf-8' ) except ImportError : def not_available ( * args , ** kwargs ) : raise SerializerNotInstalled ( 'No decoder installed for YAML. Install the PyYAML library' ) registry . register ( 'yaml' , None , not_available , 'application/x-yaml' )
register a encoder/decoder for yaml serialization .