def label_mapper(raw_labels, new_labels):
    """Map some raw labels into new labels.

    When dealing with GEO DataSets it is very common that each GSM sample has
    a different phenotye (e.g. 'Brain - 001', 'Brain - 002', ...). This
    function maps these raw labels into new homogeneous labels.

    Parameters
    -----------
    raw_labels : list of strings
        list of unpreprocessed labels
    new_labels : list of strings
        list of labels to map

    Returns
    -----------
    y : array of float, shape : n_samples
        the modified label vector

    Examples
    -----------
    >>> raw_labels = ['Brain - 001', 'Brain - 002', 'Muscle - 001', 'Muscle - 002']
    >>> label_mapper(raw_labels, ['Brain', 'Muscle'])
    ['Brain', 'Brain', 'Muscle', 'Muscle']
    """
    y = []
    for rl in raw_labels:
        for nl in new_labels:
            if nl in rl:
                y.append(nl)
                break
        else:
            y.append(rl)
            # print('No mapping rule for %s', rl)
    return y