code: def _duration(start, end):
      
      if start and end:
          if start > end:
              return None
          else:
              return end - start
      elif start:
          return time.time() - start
      else:
          return None
docs: Return time delta.