code: def read_yaml(yaml_data, schema):
      
      try:
          resource = resource_stream('atomic_reactor', schema)
          schema = codecs.getreader('utf-8')(resource)
      except (IOError, TypeError):
          logger.error('unable to extract JSON schema, cannot validate')
          raise
  
      try:
          schema = json.load(schema)
      except ValueError:
          logger.error('unable to decode JSON schema, cannot validate')
          raise
      data = yaml.safe_load(yaml_data)
      validator = jsonschema.Draft4Validator(schema=schema)
      try:
          jsonschema.Draft4Validator.check_schema(schema)
          validator.validate(data)
      except jsonschema.SchemaError:
          logger.error('invalid schema, cannot validate')
          raise
      except jsonschema.ValidationError:
          for error in validator.iter_errors(data):
              path = "".join(
                  ('[{}]' if isinstance(element, int) else '.{}').format(element)
                  for element in error.path
              )
  
              if path.startswith('.'):
                  path = path[1:]
  
              logger.error('validation error (%s): %s', path or 'at top level', error.message)
  
          raise
  
      return data
docs: :param yaml_data: string, yaml content