def get_service_regex(base_url, service_url, sub_service):
        """Get the regex for a given service.

        :param base_url: string - Base URI
        :param service_url: string - Service URI under the Base URI
        :param sub_service: boolean - is the Service URI for a sub-service?

        :returns: Python Regex object containing the regex for the Service
        """
        # if the specified service_url is already a regex
        # then just use. Otherwise create what we need
        if StackInABoxService.is_regex(service_url):
            logger.debug('StackInABoxService: Received regex {0} for use...'
                         .format(service_url.pattern))

            # Validate the regex against StackInABoxService requirement
            StackInABoxService.validate_regex(service_url, sub_service)

            return service_url
        else:
            regex = '^{0}{1}$'.format('', service_url)
            logger.debug('StackInABoxService: {0} + {1} -> {2}'
                         .format(base_url, service_url, regex))
            return re.compile(regex)
Get the regex for a given service.

        :param base_url: string - Base URI
        :param service_url: string - Service URI under the Base URI
        :param sub_service: boolean - is the Service URI for a sub-service?

        :returns: Python Regex object containing the regex for the Service