some_dict.get("username", "default")
try: u = some_dict["username"] except KeyError: # long error case code if needed