manipulate element with type, e.g. quad

            input parameters:
            :param beamline: beamline definition keyword
            :param type: element type, case insensitive
            :param irange: slice index, see getElementByOrder()
            :param property: element property, e.g. 'k1' for 'quad' strength
            :param opstr: operation, '+[-]n%' or '+[-*/]n'

def manipulateLattice(self, beamline, type='quad',
                          irange='all', property='k1',
                          opstr='+0%'):
        """ manipulate element with type, e.g. quad

            input parameters:
            :param beamline: beamline definition keyword
            :param type: element type, case insensitive
            :param irange: slice index, see getElementByOrder()
            :param property: element property, e.g. 'k1' for 'quad' strength
            :param opstr: operation, '+[-]n%' or '+[-*/]n'
        """
        # lattice_list = self.getFullBeamline(beamline, extend = True)
        # orderedLattice_list = self.orderLattice(beamline)
        opele_list = self.getElementByOrder(beamline, type, irange)

        opr = opstr[0]
        opn = float(opstr[1:].strip('%'))

        if opstr[-1] == '%':
            opn /= 100.0
            opsdict = {'+': lambda a, p: a * (1 + p),
                       '-': lambda a, p: a * (1 - p)}
        else:
            opsdict = {'+': lambda a, p: a + p,
                       '-': lambda a, p: a - p,
                       '*': lambda a, p: a * p,
                       '/': lambda a, p: a / float(p)}

        for ename, etype, eid in opele_list:
            val0_old = self.all_elements[ename.upper()].values()[0].get(property.lower())
            val0_new = opsdict[opr](val0_old, opn)
            self.all_elements[ename.upper()].values()[0][property.lower()] = val0_new

        return True