def get_flags_from_rst(rst_file):
    """Return dict of plot2rst flags found in reStructuredText file.

    Flags should have the form:

        .. plot2rst_*:: value

    """
    flags = {}
    with open(rst_file) as f:
        for line in f:
            if line.startswith('.. plot2rst'):
                line = line.lstrip('.. ')
                k, v = [word.strip() for word in line.split('::')]
                flags[k] = v
    return flags