code: def get_epoch_time_from_str(s):
      
      try:
          return int(s)
      except:
          pass
  
      try:
          if s.startswith('-'):
              chars = {'d': 24 * 60 * 60,
                       'h': 60 * 60,
                       'm': 60,
                       's': 1}
              m = chars.get(s[-1])
              if m:
                  n = float(s[1:-1])
                  secs = int(n * m)
                  now = int(time.time())
                  return max((now - secs), 0)
      except:
          pass
  
      raise ValueError("'%s' is an unrecognised time format." % s)
docs: Convert a string into epoch time. Examples of valid strings:
  
          1418350671  # already epoch time
          -12s        # 12 seconds ago
          -5.4m       # 5.4 minutes ago