def __init__(self, name, ports, namespace='<STR_LIT:default>', labels=None, selector=None,<EOL>create_in_cluster=False, spec=None):
self.name = name<EOL>self.namespace = namespace<EOL>self.ports = ports<EOL>exposed_ports = metadata_ports_to_k8s_ports(self.ports)<EOL>self.metadata = client.V1ObjectMeta(name=self.name, namespace=self.namespace, labels=labels)<EOL>self.spec = spec or client.V1ServiceSpec(ports=exposed_ports, selector=selector)<EOL>self.body = client.V1Service(spec=self.spec, metadata=self.metadata)<EOL>self.api = get_core_api()<EOL>if create_in_cluster:<EOL><INDENT>self.create_in_cluster()<EOL><DEDENT>
Utility functions for kubernetes services.

:param name: str, name of the service
:param namespace: str, name of the namespace
:param ports: list of str, list of exposed ports, example:
        - ['1234/tcp', '8080/udp']
:param labels: dict, dict of labels
:param selector: dict, route service traffic to pods with label keys and
    values matching this selector