'Validate the alias, and return the number of arguments.'

def validate(self):

    if (self.name in self.blacklist):
        raise InvalidAliasError(("The    name    %s    can't    be    aliased    because    it    is    a    keyword    or    builtin." % self.name))
    try:
        caller = self.shell.magics_manager.magics['line'][self.name]
    except KeyError:
        pass
    else:
        if (not isinstance(caller, Alias)):
            raise InvalidAliasError(("The    name    %s    can't    be    aliased    because    it    is    another    magic    command." % self.name))
    if (not isinstance(self.cmd, str)):
        raise InvalidAliasError(('An    alias    command    must    be    a    string,    got:    %r' % self.cmd))
    nargs = (self.cmd.count('%s') - self.cmd.count('%%s'))
    if ((nargs > 0) and (self.cmd.find('%l') >= 0)):
        raise InvalidAliasError('The    %s    and    %l    specifiers    are    mutually    exclusive    in    alias    definitions.')
    return nargs
