def calculate_duration(start, end, unfinished_reason):
    """
	Calculates the duration between two timestamps. If 'end' is None (thereby
	yielding the calculation impossible) then 'unfinished_reason' is returned.
	"""
    if start is None or end is None:
        return unfinished_reason
    else:
        return end - start
