Performs the login against zimbra
        (sends AuthRequest, receives AuthResponse).

        :param namespace: if specified, the namespace used for authetication
                         (if the client namespace is not suitable for
                         authentication).

def login(self, username, password, namespace=None):
        """ Performs the login against zimbra
        (sends AuthRequest, receives AuthResponse).

        :param namespace: if specified, the namespace used for authetication
                         (if the client namespace is not suitable for
                         authentication).
        """

        if namespace is None:
            namespace = self.client.NAMESPACE

        data = self.client.request(
            'Auth',
            {
                'account': zobjects.Account(name=username).to_selector(),
                'password': {'_content': password}
            },
            namespace)
        self.authToken = data['authToken']
        lifetime = int(data['lifetime'])

        self.authToken = str(self.authToken)
        self.set_end_date(lifetime)