<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def gait_regularity_symmetry(self, x, average_step_duration='autodetect', average_stride_duration='autodetect', unbias=1, normalize=2):
 """ Compute step and stride regularity and symmetry from accelerometer data with the help of steps and strides. :param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc. :type x: pandas.Series :param average_step_duration: Average duration of each step using the same time unit as the time series. If this is set to 'autodetect' it will infer this from the time series. :type average_step_duration: float :param average_stride_duration: Average duration of each stride using the same time unit as the time series. If this is set to 'autodetect' it will infer this from the time series. :type average_stride_duration: float :param unbias: Unbiased autocorrelation: divide by range (unbias=1) or by weighted range (unbias=2). :type unbias: int :param int normalize: Normalize: divide by 1st coefficient (normalize=1) or by maximum abs. value (normalize=2). :type normalize: int :return step_regularity: Step regularity measure along axis. :rtype step_regularity: float :return stride_regularity: Stride regularity measure along axis. :rtype stride_regularity: float :return symmetry: Symmetry measure along axis. :rtype symmetry: float """

        if (average_step_duration=='autodetect') or (average_stride_duration=='autodetect'):

            strikes, _ = self.heel_strikes(x)

            step_durations = []
            for i in range(1, np.size(strikes)):
                step_durations.append(strikes[i] - strikes[i-1])

            average_step_duration = np.mean(step_durations)

            number_of_steps = np.size(strikes)

            strides1 = strikes[0::2]
            strides2 = strikes[1::2]

            stride_durations1 = []
            for i in range(1, np.size(strides1)):
                stride_durations1.append(strides1[i] - strides1[i-1])

            stride_durations2 = []
            for i in range(1, np.size(strides2)):
                stride_durations2.append(strides2[i] - strides2[i-1])

            strides = [strides1, strides2]
            stride_durations = [stride_durations1, stride_durations2]

            average_stride_duration = np.mean((np.mean(stride_durations1),
                                        np.mean(stride_durations2)))

            return self.gait_regularity_symmetry(x, average_step_duration, average_stride_duration)
        
        else:
            coefficients, _ = autocorrelate(x, unbias=1, normalize=2)

            step_period = np.int(np.round(1 / average_step_duration))
            stride_period = np.int(np.round(1 / average_stride_duration))

            step_regularity = coefficients[step_period]
            stride_regularity = coefficients[stride_period]
            symmetry = np.abs(stride_regularity - step_regularity)

            return step_regularity, stride_regularity, symmetry