(expr, dict_data)
If expr is a string, will do a dict lookup using that string as a key.

    If expr is a callable, will call it on the dict.
If expr is a string, will do a dict lookup using that string as a key.
If expr is a string will do a dict lookup using that string as a key .
def eval_expr(expr, dict_data):
    """
    If expr is a string, will do a dict lookup using that string as a key.

    If expr is a callable, will call it on the dict.
    """
    if callable(expr):
        return expr(dict_data)
    else:
        return dict_data.get(expr, None)
def eval_expr ( expr , dict_data ) : if callable ( expr ) : return expr ( dict_data ) else : return dict_data . get ( expr , None )