'Called on a cost object and returns the number of actual cost values.
Arguments:
item (Cost): cost object'

def recursive_multicost_len(self, item):

    if (type(item) == Multicost):
        return sum((self.recursive_multicost_len(subitem) for subitem in item.costs))
    else:
        return 1
