def errmsg(msg, doc, pos, end=None):
    lineno, colno = linecol(doc, pos)
if end is None:
    fmt = '{0}: line {1} column {2} (char {3})'
return fmt.format(msg, lineno, colno, pos)
endlineno, endcolno = linecol(doc, end)
fmt = '{0}: line {1} column {2} - line {3} column {4} (char {5} - {6})'
return fmt.format(msg, lineno, colno, endlineno, endcolno, pos, end)
How to get error location from json.loads in Python