def compute_sizes(sizes, size_fn, scaling_factor, scaling_method, base_size):
    """
    Scales point sizes according to a scaling factor,
    base size and size_fn, which will be applied before
    scaling.
    """
    if sizes.dtype.kind not in ('i', 'f'):
        return None
    if scaling_method == 'area':
        pass
    elif scaling_method == 'width':
        scaling_factor = scaling_factor ** 2
    else:
        raise ValueError(
            'Invalid value for argument "scaling_method": "{}". Valid values are: "width", "area".'
            .format(scaling_method))
    sizes = size_fn(sizes)
    return base_size * scaling_factor * sizes
