'Check if a data server can be removed.'

def HandleServerRemCheck(self):

    if (not self.MASTER):
        return self._EmptyResponse(constants.RESPONSE_NOT_MASTER_SERVER)
    if (not self.MASTER.AllRegistered()):
        return self._EmptyResponse(constants.RESPONSE_DATA_SERVERS_UNREACHABLE)
    if self.MASTER.IsRebalancing():
        return self._EmptyResponse(constants.RESPONSE_MASTER_IS_REBALANCING)
    (addr, port) = self._UnpackNewServer()
    server = self.MASTER.HasServer(addr, port)
    if (not server):
        return self._EmptyResponse(constants.RESPONSE_DATA_SERVER_NOT_FOUND)
    interval = server.Interval()
    if (interval.start != interval.end):
        return self._EmptyResponse(constants.RESPONSE_RANGE_NOT_EMPTY)
    return self._EmptyResponse(constants.RESPONSE_OK)
