def read_spec(filename, verbose=False):
  """
  Read an SBP specification.

  Parameters
  ----------
  filename : str
    Local filename for specification.
  verbose : bool
    Print out some debugging info

  Returns
  ----------

  Raises
  ----------
  Exception
    On empty file.
  yaml.YAMLError
    On Yaml parsing error
  voluptuous.Invalid
    On invalid SBP schema
  """
  contents = None
  with open(filename, 'r') as f:
    contents = yaml.load(f)
    if contents is None:
      raise Exception("Empty yaml file: %s." % filename)
    try:
      s.package_schema(contents)
    except Exception as e:
      sys.stderr.write("Invalid SBP YAML specification: %s.\n" % filename)
      raise e
  return contents
Read an SBP specification.

  Parameters
  ----------
  filename : str
    Local filename for specification.
  verbose : bool
    Print out some debugging info

  Returns
  ----------

  Raises
  ----------
  Exception
    On empty file.
  yaml.YAMLError
    On Yaml parsing error
  voluptuous.Invalid
    On invalid SBP schema