def format_source(text):
    """Given source lines of code as a string, strip leading lines and
    return a block of text.  This is done so the output is valid YAML.
    """
    src = text.splitlines()
    code = []
    first_non_empty_line = 0
    for line in src:
        if len(line.strip()) == 0:
            code.append('')
            first_non_empty_line += 1
        else:
            break
    code += src[first_non_empty_line:]
    return '\n'.join(code)
