'Groups all node-aliases that have similar instance types/image ids
Returns a dictionary that\'s used to launch all similar instance types
and image ids in the same request. Example return value:
{(\'c1.xlarge\', \'ami-a5c02dcc\'): [\'node001\', \'node002\'],
(\'m1.large\', \'ami-a5c02dcc\'): [\'node003\'],
(\'m1.small\', \'ami-17b15e7e\'): [\'master\', \'node005\', \'node006\'],
(\'m1.small\', \'ami-19e17a2b\'): [\'node004\']}
Passing reverse=True will return the same information only keyed by
node aliases:
{\'master\': (\'m1.small\', \'ami-17b15e7e\'),
\'node001\': (\'c1.xlarge\', \'ami-a5c02dcc\'),
\'node002\': (\'c1.xlarge\', \'ami-a5c02dcc\'),
\'node003\': (\'m1.large\', \'ami-a5c02dcc\'),
\'node004\': (\'m1.small\', \'ami-19e17a2b\'),
\'node005\': (\'m1.small\', \'ami-17b15e7e\'),
\'node006\': (\'m1.small\', \'ami-17b15e7e\')}'

def _get_launch_map(self, reverse=False):

    lmap = {}
    mtype = (self.master_instance_type or self.node_instance_type)
    mimage = (self.master_image_id or self.node_image_id)
    lmap[(mtype, mimage)] = [self._make_alias(master=True)]
    id_start = 1
    for itype in self.node_instance_types:
        count = itype['size']
        image_id = (itype['image'] or self.node_image_id)
        type = (itype['type'] or self.node_instance_type)
        if (not ((type, image_id) in lmap)):
            lmap[(type, image_id)] = []
        for id in range(id_start, (id_start + count)):
            alias = self._make_alias(id)
            log.debug(('Launch    map:    %s    (ami:    %s,    type:    %s)...' % (alias, image_id, type)))
            lmap[(type, image_id)].append(alias)
            id_start += 1
    ntype = self.node_instance_type
    nimage = self.node_image_id
    if (not ((ntype, nimage) in lmap)):
        lmap[(ntype, nimage)] = []
    for id in range(id_start, self.cluster_size):
        alias = self._make_alias(id)
        log.debug(('Launch    map:    %s    (ami:    %s,    type:    %s)...' % (alias, nimage, ntype)))
        lmap[(ntype, nimage)].append(alias)
    if reverse:
        rlmap = {}
        for (itype, image_id) in lmap:
            aliases = lmap.get((itype, image_id))
            for alias in aliases:
                rlmap[alias] = (itype, image_id)
        return rlmap
    return lmap
