Factory method to get the correct AuthInfo object.

        The returned value depends on the arguments given. In case the
        username and password don't have a value (ie evaluate to False),
        return an object for anonymous access. Else, return an auth
        object that supports basic authentication.

        Args:
            `username`: The username of the user.
            `password`: The password of the user.
            `headers`: Custom headers to be sent to each request.
        Raises:
            ValueError in case one of the two arguments evaluates to False,
            (such as having the None value).

def get(self, username=None, password=None, headers={}):
        """Factory method to get the correct AuthInfo object.

        The returned value depends on the arguments given. In case the
        username and password don't have a value (ie evaluate to False),
        return an object for anonymous access. Else, return an auth
        object that supports basic authentication.

        Args:
            `username`: The username of the user.
            `password`: The password of the user.
            `headers`: Custom headers to be sent to each request.
        Raises:
            ValueError in case one of the two arguments evaluates to False,
            (such as having the None value).
        """
        if all((username, password, )):
            return BasicAuth(username, password, headers)
        elif not any((username, password, )):
            return AnonymousAuth(headers)
        else:
            if username is None:
                data = ("username", username, )
            else:
                data = ("Password", password, )
            msg = "%s must have a value (instead of '%s')" % (data[0], data[1])
            raise ValueError(msg)