<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def constrain_property(self,prop,lo=-np.inf,hi=np.inf, measurement=None,thresh=3, selectfrac_skip=False,distribution_skip=False):
 """Apply constraint that constrains property. :param prop: Name of property. Must be column in ``self.stars``. :type prop: ``str`` :param lo,hi: (optional) Low and high allowed values for ``prop``. Defaults to ``-np.inf`` and ``np.inf`` to allow for defining only lower or upper limits if desired. :param measurement: (optional) Value and error of measurement in form ``(value, error)``. :param thresh: (optional) Number of "sigma" to allow for measurement constraint. :param selectfrac_skip,distribution_skip: Passed to :func:`StarPopulation.apply_constraint`. """

        if prop in self.constraints:
            logging.info('re-doing {} constraint'.format(prop))
            self.remove_constraint(prop)
        if measurement is not None:
            val,dval = measurement
            self.apply_constraint(MeasurementConstraint(getattr(self.stars,prop),
                                                        val,dval,name=prop,
                                                        thresh=thresh),
                                  selectfrac_skip=selectfrac_skip,
                                  distribution_skip=distribution_skip)
        else:
            self.apply_constraint(RangeConstraint(getattr(self.stars,prop),
                                                  lo=lo,hi=hi,name=prop),
                                  selectfrac_skip=selectfrac_skip,
                                  distribution_skip=distribution_skip)