def custom_formatter(selector, formatstr):
    """
    Creates a formatter based on applying the function selector on the
    item to be stringified and then interpolates the results using formatstr
    :selector: Function returns the values to be interpolated using formatstr
    :param formatstr: The formatting string , i.e. '%s, %s' etc
    """
    return lambda item: formatstr % selector(item)