def datetime_ambiguous(dt, tz=None):
if tz is None:<EOL><INDENT>if dt.tzinfo is None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>tz = dt.tzinfo<EOL><DEDENT>is_ambiguous_fn = getattr(tz, '<STR_LIT>', None)<EOL>if is_ambiguous_fn is not None:<EOL><INDENT>try:<EOL><INDENT>return tz.is_ambiguous(dt)<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>dt = dt.replace(tzinfo=tz)<EOL>wall_0 = enfold(dt, fold=<NUM_LIT:0>)<EOL>wall_1 = enfold(dt, fold=<NUM_LIT:1>)<EOL>same_offset = wall_0.utcoffset() == wall_1.utcoffset()<EOL>same_dst = wall_0.dst() == wall_1.dst()<EOL>return not (same_offset and same_dst)<EOL>
Given a datetime and a time zone, determine whether or not a given datetime
is ambiguous (i.e if there are two times differentiated only by their DST
status).

:param dt:
    A :class:`datetime.datetime` (whose time zone will be ignored if ``tz``
    is provided.)

:param tz:
    A :class:`datetime.tzinfo` with support for the ``fold`` attribute. If
    ``None`` or not provided, the datetime's own time zone will be used.

:return:
    Returns a boolean value whether or not the "wall time" is ambiguous in
    ``tz``.

.. versionadded:: 2.6.0