def load_json_dict(filename, *args):
 data = {}
 if os.path.exists(filename):
  lock.acquire()
  with open(filename, 'r') as f:
   try:
    data = _json.load(f)
    if (not isinstance(data, dict)):
     data = {}
   except:
    data = {}
  lock.release()
  if args:
   return {key: data[key] for key in args if (key in data)}
 return data

def load_json_dict ( filename , * args ) : data = { } if os . path . exists ( filename ) : lock . acquire ( ) with open ( filename , 'r' ) as f : try : data = _json . load ( f ) if ( not isinstance ( data , dict ) ) : data = { } except : data = { } lock . release ( ) if args : return { key : data [ key ] for key in args if ( key in data ) } return data
checks if file exists .