def get_labels(ds, qties, weight, normed):
    """
    Returns the labels of given qties.

    Parameters
    ----------
    ds : {PhaseSpace, ScalarField, EventLocation}
        Dataset to use.
    qties : list of str
        Names of the qties
    normed : list of bool or None
        Weight normalization. If None, the last labels element is "Number", otherwise it is "Number/unit1/unit2/..."

    Returns
    -------
    labels : list of str
        Labels of given qty and label of weight
    """
    labels = []
    qties_labels = []
    qties_units = []
    for qty in qties:
        qties_labels.append(ds.metadata.quantity[qty]['label'])
        qty_dim = ds.metadata.quantity[qty]['dimension']
        qties_units.append(ds.metadata.unit[qty_dim]['label'])
    axis_labels = []
    for qty_label, qty_unit in zip(qties_labels, qties_units):
        if qty_unit == '':
            axis_labels.append('${label}$'.format(label=qty_label))
        else:
            axis_labels.append('${label}$ [${unit}$]'.format(label=
                qty_label, unit=qty_unit))
    weight_label = ds.metadata.quantity[weight]['label']
    weight_dim = ds.metadata.quantity[weight]['dimension']
    weight_unit = ds.metadata.unit[weight_dim]['label']
    title_unit = ' ~'.join(qties_units)
    if normed == False:
        title_label = '${label}$'.format(label=weight_label)
    else:
        numerator_label = 'd' + weight_label
        denominator_label = 'd' + ' ~d'.join(qties_labels)
        if title_unit.strip() == '':
            title_label = '$%s/%s$' % (numerator_label, denominator_label)
        else:
            title_label = '$%s/%s$ [$(%s)^{-1}$]' % (numerator_label,
                denominator_label, title_unit)
    return [*axis_labels, title_label]
