def get_id(self, natural_key, date, enhancement=None):
if not date:<EOL><INDENT>return None<EOL><DEDENT>if natural_key in self._map:<EOL><INDENT>for row in self._map[natural_key]:<EOL><INDENT>if row[<NUM_LIT:0>] <= date <= row[<NUM_LIT:1>]:<EOL><INDENT>return row[<NUM_LIT:2>]<EOL><DEDENT><DEDENT><DEDENT>self.pre_call_stored_procedure()<EOL>success = False<EOL>try:<EOL><INDENT>row = self.call_stored_procedure(natural_key, date, enhancement)<EOL>if isinstance(row[self._key_date_start], datetime.date):<EOL><INDENT>row[self._key_date_start] = row[self._key_date_start].isoformat()<EOL><DEDENT>if isinstance(row[self._key_date_end], datetime.date):<EOL><INDENT>row[self._key_date_end] = row[self._key_date_end].isoformat()<EOL><DEDENT>success = True<EOL><DEDENT>finally:<EOL><INDENT>self.post_call_stored_procedure(success)<EOL><DEDENT>if natural_key not in self._map:<EOL><INDENT>self._map[natural_key] = []<EOL><DEDENT>if row[self._key_key]:<EOL><INDENT>self._map[natural_key].append((row[self._key_date_start],<EOL>row[self._key_date_end],<EOL>row[self._key_key]))<EOL><DEDENT>else:<EOL><INDENT>self._map[natural_key].append((date, date, None))<EOL><DEDENT>return row[self._key_key]<EOL>
Returns the technical ID for a natural key at a date or None if the given natural key is not valid.

:param T natural_key: The natural key.
:param str date: The date in ISO 8601 (YYYY-MM-DD) format.
:param T enhancement: Enhancement data of the dimension row.

:rtype: int|None