Return a function to launch the web browser or print a result

def get_action(args):
    """Return a function to launch the web browser or print a result"""
    redirect_mode = args.bang or args.search or args.lucky
    if redirect_mode and not args.url:
        return webbrowser.open_new_tab
    else:
        return print_result