'Creates a datacenter.
ProfitBricks has a concept of datacenters.
These represent buckets into which you
can place various compute resources.
:param  name: The datacenter name.
:type   name: : ``str``
:param  location: instance of class ``NodeLocation``.
:type   location: : ``NodeLocation``
:param  description: The datacenter description.
:type   description: : ``str``
:return:    Instance of class ``Datacenter``
:rtype:     :class:`Datacenter`'

def ex_create_datacenter(self, name, location, description=None):

    body = {'properties': {'name': name, 'location': location.id}}
    if (description is not None):
        body['properties']['description'] = description
    body['entities'] = defaultdict(dict)
    body['entities']['lans']['items'] = [{'properties': {'name': (name + '    -    public    lan'), 'public': True}}, {'properties': {'name': (name + '    -    private    lan'), 'public': False}}]
    response = self.connection.request(action='datacenters', headers={'Content-Type': 'application/json'}, data=body, method='POST')
    return self._to_datacenter(response.object, response.headers)
