'instantiates a service dict'

def create_dict(self):

    self.data['apiVersion'] = 'v1'
    self.data['kind'] = 'Service'
    self.data['metadata'] = {}
    self.data['metadata']['name'] = self.name
    self.data['metadata']['namespace'] = self.namespace
    if self.labels:
        self.data['metadata']['labels'] = {}
        for (lab, lab_value) in self.labels.items():
            self.data['metadata']['labels'][lab] = lab_value
    self.data['spec'] = {}
    if self.ports:
        self.data['spec']['ports'] = self.ports
    else:
        self.data['spec']['ports'] = []
    if self.selector:
        self.data['spec']['selector'] = self.selector
    self.data['spec']['sessionAffinity'] = (self.session_affinity or 'None')
    if self.cluster_ip:
        self.data['spec']['clusterIP'] = self.cluster_ip
    if self.portal_ip:
        self.data['spec']['portalIP'] = self.portal_ip
    if self.service_type:
        self.data['spec']['type'] = self.service_type
    if self.external_ips:
        self.data['spec']['externalIPs'] = self.external_ips
