import ast


def count_arity_ast(node):
    """
    Returns the number of the arguments that the function receives.

    Parameters
    ----------
    node : ast

    Returns
    -------
    None           if type(node) is not a function definition.
    float("inf")   if function is variadic
    int            otherwise
    """
    if type(node) in {ast.Lambda, ast.FunctionDef}:
        if any(
                [getattr(node.arguments, cat) is not None
                 for cat in {"vararg", "kwarg"}]
        ):
            return float("inf")
        return len(node.arguments.args)
    return None