'Create and attach a Lan to a data center.
:param  datacenter: The DC you are renaming.
:type   datacenter: :class:`Datacenter`
:param  is_public: True if the Lan is to have internet access.
:type   is_public: ``bool``
:param  nics: Optional network interfaces to attach to the lan.
:param  nics: ``list`` of class ``ProfitBricksNetworkInterface``
:return:    Instance class ``ProfitBricksLan``
:rtype:     :class:`ProfitBricksLan`'

def ex_create_lan(self, datacenter, is_public=False, nics=None):

    action = datacenter.extra['entities']['lans']['href']
    body = {'properties': {'name': 'LAN    -    {datacenter_name}'.format(datacenter_name=datacenter.name), 'public': is_public}}
    if (nics is not None):
        body['entities'] = defaultdict(dict)
        body['entities']['nics']['items'] = [{'id': nic.id} for nic in nics]
    request = self.connection.request(action=action, headers={'Content-Type': 'application/json'}, data=body, method='POST', with_full_url=True)
    return self._to_lan(request.object, request.headers)
