def maybe_iso8601(dt):
 if (not dt):
  return
 if isinstance(dt, datetime):
  return dt
 return parse_iso8601(dt)

def maybe_iso8601 ( dt ) : if ( not dt ) : return if isinstance ( dt , datetime ) : return dt return parse_iso8601 ( dt )
either datetime | str -> datetime or none -> none .