def get_context_text(pathfile):
    """
    Parse file an return context ( yaml ) and text.
    Context is between "{% zorna" tag and "%}" tag
    """
    start = re.compile(r'.*?{%\s*zorna\s+(.*?)(%}|$)')
    end = re.compile(r'(.*?)(%})')
    try:
        fin = open(pathfile, 'r')
    except __HOLE__:
        return '', ''
    started = False
    context = ''
    text = ''
    matcher = start
    for line in fin:
        match = matcher.match(line)
        if match:
            context = context + match.group(1)
            if started:
                break
            else:
                matcher = end
                started = True
        elif started:
            context = context + line
        else:
            text = text + line
    for line in fin:
        text = text + line
    # tag_re = re.compile(r'(%s\s*block(.*?)\s*%s)(.*?)(%s\s*endblock.*?\s*%s)' % (re.escape('{%'), re.escape('%}'),re.escape('{%'), re.escape('%}')), re.M|re.DOTALL)
    # tag_re2 = re.compile(r'(%s\s*zorna)(.*?)(\s*%s)' % (re.escape('{%'), re.escape('%}')), re.M|re.DOTALL)
    # for match in tag_re.finditer(text):
    #    g = match.groups()
    return context, text
dataset/ETHPy150Open zorna/zorna/zorna/utils.py/get_context_text