import threading


def StrptimeRun(strptime, patched):
  """Checks the given strptime function runs without raising an Exception.

  Returns:
    True on success, False on failure.
  """
  if patched:
    import _strptime  # pylint: disable=unused-import

  def Target(fn):
    global error  # pylint: disable=global-statement
    try:
      fn('Tue Aug 16 21:30:00 1988', '%c')
    except AttributeError:
      error = True

  threads = []
  for unused_i in range(2):
    t = threading.Thread(target=Target, args=(strptime,))
    t.start()
    threads.append(t)
  for t in threads:
    t.join()

  return not error