<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def query_relative(self, query, event_time=None, relative_duration_before=None, relative_duration_after=None):
 """Perform the query and calculate the time range based on the relative values."""

        assert event_time is None or isinstance(event_time, datetime.datetime)
        assert relative_duration_before is None or isinstance(relative_duration_before, str)
        assert relative_duration_after is None or isinstance(relative_duration_after, str)

        if event_time is None:
            # use now as the default 
            event_time = datetime.datetime.now()

        # use preconfigured defaults
        if relative_duration_before is None:
            relative_duration_before = self.relative_duration_before

        if relative_duration_after is None:
            relative_duration_after = self.relative_duration_after
        
        time_start = event_time - create_timedelta(relative_duration_before)
        time_end = event_time + create_timedelta(relative_duration_after)
        return self.query_with_time(query, time_start, time_end)