def remove_yaml_frontmatter(source, return_frontmatter=False):
    """If there's one, remove the YAML front-matter from the source
    """
    if source.startswith('---\n'):
        frontmatter_end = source.find('\n---\n', 4)
        if frontmatter_end == -1:
            frontmatter = source
            source = ''
        else:
            frontmatter = source[0:frontmatter_end]
            source = source[frontmatter_end + 5:]
        if return_frontmatter:
            return source, frontmatter
        return source
    if return_frontmatter:
        return source, None
    return source
