def load_json(filename):
 try:
  if PY2:
   args = 'rb'
  else:
   args = 'r'
  with open(filename, args) as fid:
   data = json.load(fid)
  return (data, None)
 except Exception as err:
  return (None, str(err))

def load_json ( filename ) : try : if PY2 : args = 'rb' else : args = 'r' with open ( filename , args ) as fid : data = json . load ( fid ) return ( data , None ) except Exception as err : return ( None , str ( err ) )
load data from a json file parameters filename : str filename to load data from .