human
Complete this python program:
def get_yaml(path):
assistant
#Here is the Python code you requested.

    """Read the file identified by `path` and import its YAML contents.
    :arg path: The path to a YAML configuration file.
    :rtype: dict
    """
    single = re.compile('^\\$\\{(.*)\\}$')
    yaml.add_implicit_resolver('!single', single)
    def single_constructor(loader, node):
        value = loader.construct_scalar(node)
        proto = single.match(value).group(1)
        default = None
        if (len(proto.split(':')) > 1):
            (envvar, default) = proto.split(':')
        else:
            envvar = proto
        return (os.environ[envvar] if (envvar in os.environ) else default)
    yaml.add_constructor('!single', single_constructor)
    raw = read_file(path)
    try:
        cfg = yaml.load(raw)
    except yaml.scanner.ScannerError as e:
        raise ConfigurationError('Unable    to    parse    YAML    file.    Error:    {0}'.format(e))
    return cfg