'Print `EXPLAIN` in error log.'

def explain_query(self, query, values=None):

    try:
        frappe.errprint(u'---    query    explain    ---')
        if (values is None):
            self._cursor.execute((u'explain    ' + query))
        else:
            self._cursor.execute((u'explain    ' + query), values)
        import json
        frappe.errprint(json.dumps(self.fetch_as_dict(), indent=1))
        frappe.errprint(u'---    query    explain    end    ---')
    except:
        frappe.errprint(u'error    in    query    explain')
