def find_callback(args, kw=None):
    """Return callback whether passed as a last argument or as a keyword"""
    if args and callable(args[-1]):
        return args[-1], args[:-1]
    try:
        return kw['callback'], args
    except (KeyError, TypeError):
        return None, args
