code: def instant(instant):
      
      if instant is None:
          return None
      if isinstance(instant, Instant):
          return instant
      if isinstance(instant, str):
          if not INSTANT_PATTERN.match(instant):
              raise ValueError("'{}' is not a valid instant. Instants are described using the 'YYYY-MM-DD' format, for instance '2015-06-15'.".format(instant))
          instant = Instant(
              int(fragment)
              for fragment in instant.split('-', 2)[:3]
              )
      elif isinstance(instant, datetime.date):
          instant = Instant((instant.year, instant.month, instant.day))
      elif isinstance(instant, int):
          instant = (instant,)
      elif isinstance(instant, list):
          assert 1 <= len(instant) <= 3
          instant = tuple(instant)
      elif isinstance(instant, Period):
          instant = instant.start
      else:
          assert isinstance(instant, tuple), instant
          assert 1 <= len(instant) <= 3
      if len(instant) == 1:
          return Instant((instant[0], 1, 1))
      if len(instant) == 2:
          return Instant((instant[0], instant[1], 1))
      return Instant(instant)
docs: Return a new instant, aka a triple of integers (year, month, day).
  
      >>> instant(2014)
      Instant((2014, 1, 1))
      >>> instant('2014')
      Instant((2014, 1, 1))
      >>> instant('2014-02')
      Instant((2014, 2, 1))
      >>> instant('2014-3-2')
      Instant((2014, 3, 2))
      >>> instant(instant('2014-3-2'))
      Instant((2014, 3, 2))
      >>> instant(period('month', '2014-3-2'))
      Instant((2014, 3, 2))
  
      >>> instant(None)