def intersection(self, x):
self.validate_time_inversion()<EOL>x.validate_time_inversion()<EOL>if any([x.start_datetime in self, self.start_datetime in x]):<EOL><INDENT>start_datetime = max(self.start_datetime, x.start_datetime)<EOL>end_datetime = min(self.end_datetime, x.end_datetime)<EOL><DEDENT>else:<EOL><INDENT>start_datetime = None<EOL>end_datetime = None<EOL><DEDENT>return DateTimeRange(<EOL>start_datetime=start_datetime,<EOL>end_datetime=end_datetime,<EOL>start_time_format=self.start_time_format,<EOL>end_time_format=self.end_time_format,<EOL>)<EOL>
Newly set a time range that overlaps
the input and the current time range.

:param DateTimeRange x:
    Value to compute intersection with the current time range.

:Sample Code:
    .. code:: python

        from datetimerange import DateTimeRange
        dtr0 = DateTimeRange("2015-03-22T10:00:00+0900", "2015-03-22T10:10:00+0900")
        dtr1 = DateTimeRange("2015-03-22T10:05:00+0900", "2015-03-22T10:15:00+0900")
        dtr0.intersection(dtr1)
:Output:
    .. parsed-literal::

        2015-03-22T10:05:00+0900 - 2015-03-22T10:10:00+0900