'Remove server from group.'

def _RemServer(self, addr, port):

    (server, _) = self._FindServer(addr, port)
    if (not server):
        print 'Server    not    found.'
        return
    if (server.interval.start != server.interval.end):
        print 'Server    has    some    data    in    it!'
        print 'Giving    up...'
        return
    pool = None
    try:
        pool = urllib3.connectionpool.HTTPConnectionPool(self.addr, port=self.port)
    except urllib3.exceptions.MaxRetryError:
        print 'Unable    to    contact    master...'
        return
    body = self._PackNewServer(addr, port)
    headers = {'Content-Length': len(body)}
    try:
        res = pool.urlopen('POST', '/servers/rem/check', headers=headers, body=body)
    except urllib3.exceptions.MaxRetryError:
        print 'Unable    to    contact    master...'
        return
    if (res.status == constants.RESPONSE_DATA_SERVER_NOT_FOUND):
        print 'Master    server    says    the    data    server    does    not    exist.'
        return
    if (res.status == constants.RESPONSE_RANGE_NOT_EMPTY):
        print 'Master    server    says    the    data    server    has    still    some    data.'
        print 'Giving    up...'
        return
    if (res.status == constants.RESPONSE_DATA_SERVERS_UNREACHABLE):
        print 'Master    server    says    some    data    servers    are    not    running.'
        print 'Giving    up...'
        return
    if (res.status != constants.RESPONSE_OK):
        print 'Master    server    error.    Is    the    server    running?'
        return
    print ('Master    server    allows    us    to    remove    server    %s:%d' % (addr, port))
    answer = raw_input(('Do    you    really    want    to    remove    server    //%s:%d?    (y/n)    ' % (addr, port)))
    if (answer != 'y'):
        return
    try:
        res = pool.urlopen('POST', '/servers/rem', headers=headers, body=body)
    except urllib3.exceptions.MaxRetryError:
        print 'Unable    to    contact    master...'
        return
    if (res.status == constants.RESPONSE_DATA_SERVERS_UNREACHABLE):
        print 'Master    server    says    that    some    data    servers    are    not    running.'
        print 'Giving    up...'
        return
    if (res.status == constants.RESPONSE_OK):
        self.mapping = rdf_data_server.DataServerMapping.FromSerializedString(res.data)
        self._CompleteRemServerHelpComplete(addr, port)
        return
    if (res.status == constants.RESPONSE_INCOMPLETE_SYNC):
        if self._Sync():
            self._CompleteRemServerHelpComplete(addr, port)
            return
        else:
            print 'The    master    server    has    removed    the    new    server,    but    the    other    servers    may    not    know    about    it.'
            print "Please    run    'sync'    to    fix    the    problem,    followed    by:"
            self._CompleteRemServerHelp(addr, port)
            return
    if (res.status != constants.RESPONSE_OK):
        print 'Master    has    returned    an    unknown    error...'
        return
