<pre>
if device.deleted or device.deprecation_kind is None or (not ignore_depreciation and is_depreciated(device)):
    return 0
cost = price / device.deprecation_kind.months
</pre>