import yaml


def get_frontmatter(f):
    """Return front matter from a markdown file in dictionary format.

    """
    with open(f) as fp:
        s = fp.read().partition("---")[2].partition("---")[0]
        d = yaml.safe_load(s)
    return d