def get_targetID_given_index(self, exp_uid, index):
        """
        Get the client supplied target_id given an internal NEXT target index

        Inputs:
            (string) exp_uid, (int) index
        Outputs:
            (string) target_id

        Usage: ::\n
        didSucceed = targetmapper.get_targetID_given_index(exp_uid, index)
        """
        target_data,didSucceed,message = db.getDocsByPattern(self.database_id, self.bucket_id, {'exp_uid': exp_uid, 'targetless': True})
        # Pass back message if getDocsByPattern fails
        if not didSucceed:
            raise DatabaseException("Failed to get_targetID_given_index: %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 index

        # Get an individual target form the DB given exp_uid and index
        got_target,didSucceed,message = db.getDocsByPattern(self.database_id, self.bucket_id, {'exp_uid': exp_uid, 'index': index})
        # If doc cannot be retreived, throw an error
        if not didSucceed:
            raise DatabaseException("Failed to get_targetID_given_index: %s"%(message))

        # 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 target_id out of target dictionary        
        target_id = got_target['target_id']
        return target_id
dataset/ETHPy150Open nextml/NEXT/next/api/targetmapper.py/TargetMapper.get_targetID_given_index/original