def parse_metadata(path):
    # Match Django template comments.
    PATTERN = re.compile(r'^{#\s?(?P<name>\w+)\s?=\s?(?P<value>[\S\s]+)\s?#}')

    # Check only the start of the file.
    lines = io.open(path, encoding='utf-8').read().splitlines()[:100]
    lines = map(strip, lines)
    meta = dict()
    for line in lines:
        m = PATTERN.search(line)
        if m:
            name, value = m.group('name'), m.group('value')
            try:
                obj = json.loads(value)
            except ValueError as exc:
                obj = str(value)
            meta[name] = obj
    # logger.debug("path: {}, metadata: {}".format(path, meta))
    return meta
Attempts to parse out metadata from django comments.
dataset/ETHPy150Open ialbert/pyblue/pyblue/engine.py/parse_metadata