<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def remove_members_outside_rank_in(self, leaderboard_name, rank):
        '''
        Remove members from the named leaderboard in a given rank range.

        @param leaderboard_name [String] Name of the leaderboard.
        @param rank [int] the rank (inclusive) which we should keep.
        @return the total member count which was removed.
        '''
        if self.order == self.DESC:
            rank = -(rank) - 1
            return self.redis_connection.zremrangebyrank(
                leaderboard_name, 0, rank)
        else:
            return self.redis_connection.zremrangebyrank(
                leaderboard_name, rank, -1)