import re


def from_time(value):
  """Convert a human readable string representing a duration into a int as
  seconds.

  This function considers 2m1h4d a valid string for simplicity.
  """
  units = {'d': 24*60*60, 'h': 60*60, 'm': 60, 's': 1, '': 1}
  return sum(
      int(x) * units[unit]
      for x, unit in re.findall(r'(\d+)(d|h|m|s|)', value))