import time


def timestampToSeconds(timestamp):
  """
  Given a timestamp in the form '2021-08-17:21:41:18', return the number of
  seconds since epoch. Returns 0 on invalid input.
  """

  fmt = '%Y-%m-%d:%H:%M:%S'
  try:
    time_struct = time.strptime(timestamp, fmt)
  except ValueError:
    return 0

  return int(time.mktime(time_struct))