<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def extend(self, trajectory):
 """ Concatenate another trajectory Args: trajectory (Trajectory):
 Trajectory to add """

        if self.time_step != trajectory.time_step:
            raise ValueError('Trajectory not extended: Time steps of trajectories is incompatible')

        if len(self.species) != len(trajectory.species) and self.species != trajectory.species:
            raise ValueError('Trajectory not extended: species in trajectory do not match')

        self.to_positions()
        trajectory.to_positions()

        self.frac_coords = np.concatenate((self.frac_coords, trajectory.frac_coords), axis=0)
        self.lattice, self.constant_lattice = self._combine_attribute(self.lattice, trajectory.lattice,
                                                                      self.frac_coords.shape[0],
                                                                      trajectory.frac_coords.shape[0])
        self.site_properties = self._combine_attribute(self.site_properties, trajectory.site_properties,
                                                       self.frac_coords.shape[0], trajectory.frac_coords.shape[0])