def METHOD_NAME(cql, namespaces, fes_version='1.0'):
    """transforms Common Query Language (CQL) query into OGC fes1 syntax"""
    filters = []
    tmp_list = []
    logical_op = None
    LOGGER.debug('CQL: %s', cql)
    if fes_version.startswith('1.0'):
        element_or = 'ogc:Or'
        element_and = 'ogc:And'
        element_filter = 'ogc:Filter'
        element_propertyname = 'ogc:PropertyName'
        element_literal = 'ogc:Literal'
    elif fes_version.startswith('2.0'):
        element_or = 'fes20:Or'
        element_and = 'fes20:And'
        element_filter = 'fes20:Filter'
        element_propertyname = 'fes20:Literal'
    if ' or ' in cql:
        logical_op = etree.Element(util.nspath_eval(element_or, namespaces))
        tmp_list = cql.split(' or ')
    elif ' OR ' in cql:
        logical_op = etree.Element(util.nspath_eval(element_or, namespaces))
        tmp_list = cql.split(' OR ')
    elif ' and ' in cql:
        logical_op = etree.Element(util.nspath_eval(element_and, namespaces))
        tmp_list = cql.split(' and ')
    elif ' AND ' in cql:
        logical_op = etree.Element(util.nspath_eval(element_and, namespaces))
        tmp_list = cql.split(' AND ')
    if tmp_list:
        LOGGER.debug('Logical operator found (AND/OR)')
    else:
        tmp_list.append(cql)
    for t in tmp_list:
        filters.append(_parse_condition(t, fes_version))
    root = etree.Element(util.nspath_eval(element_filter, namespaces))
    if logical_op is not None:
        root.append(logical_op)
    for flt in filters:
        condition = etree.Element(util.nspath_eval(flt[0], namespaces))
        etree.SubElement(
            condition,
            util.nspath_eval(element_propertyname, namespaces)).text = flt[1]
        etree.SubElement(
            condition,
            util.nspath_eval(element_literal, namespaces)).text = flt[2]
        if logical_op is not None:
            logical_op.append(condition)
        else:
            root.append(condition)
    LOGGER.debug('Resulting OGC Filter: %s',
                 etree.tostring(root, pretty_print=1))
    return root