def racks_for_replica_list(replicas, pos=None):
    """
    Returns a set of racks for each of the given replicas in the list
    Skip the replica at position pos, if specified

    :params replicas: a list of Broker objects
    :params pos: a replica position to skip, or None to not skip a replica
    :returns: a list of racks
    """
    return [replica.rack for i, replica in enumerate(replicas) if (pos is None) or (i != pos)]