def METHOD_NAME(unit,arg,res):
    trimList = {}
    if len(arg.service) == 0:
        return unit
    else:
        if arg.regex and not arg.exclude:
            for regex in arg.service:
                for service in unit.keys():
                    if re.match(regex,service) and service not in trimList:
                        trimList[service] = unit[service]
        elif arg.regex and arg.exclude:
            trimList = unit.copy()
            for regex in arg.service:
                for service in unit.keys():
                    if re.match(regex,service):
                        del trimList[service]
        elif not arg.regex and arg.exclude:
            trimList = unit.copy()
            for service in arg.service:
                if service in trimList:
                    del trimList[service]
        else:
            for service in arg.service:
                if service in unit:
                    trimList[service] = unit[service]
                else:
                    res['notfound'].append(service)
                    res['failed'].append(service)
                    res['total'] += 1
    return(trimList)