def get_index_given_targetID(self, exp_uid, target_id):
        """
        Get the internal NEXT target index given a clients supplied target_id

        Inputs:
            (string) exp_uid, (string) target_id

        Outputs:
            (int) index

        Usage: ::\n
        didSucceed = targetmapper.get_index_given_targetID(exp_uid, target_id)
        """
        
        target_data,didSucceed,message = db.getDocsByPattern(self.database_id, self.bucket_id, {'exp_uid': exp_uid, 'targetless': False})
        # Pass back message if getDocsByPattern fails
        if not didSucceed:
            raise DatabaseException("Failed to get_index_given_targetID: %s"%(message))
        # This line is key. If no doc exists with the specified exp_uid and targetless = True, then targetless = False
        if not target_data:
            return target_id
        # Get an individual target form the DB given exp_uid and target_id
        got_target,didSucceed,message = db.getDocsByPattern(self.database_id, self.bucket_id, {'exp_uid': exp_uid, 'target_id': target_id})
        # If doc cannot be retreived, throw an error
        if not didSucceed:
            raise DatabaseException((message)%"Failed to get_index_given_targetID: %s")
        # I'm not sure if getDocsByPattern will return list if only 1 doc is retrevied. If this fails, remove this line.
        got_target = got_target.pop(0)
        # Get index out of target dictionary
        index = got_target['index']
        return int(index)
dataset/ETHPy150Open nextml/NEXT/next/api/targetmapper.py/TargetMapper.get_index_given_targetID/swapped operands of `%`