'Create a public IP resources.
:param name: Name of the public IP resource
:type name: ``str``
:param resource_group: The resource group to create the public IP
:type resource_group: ``str``
:param location: The location at which to create the public IP
(if None, use default location specified as \'region\' in __init__)
:type location: :class:`.NodeLocation`
:return: The newly created public ip object
:rtype: :class:`.AzureIPAddress`'

def ex_create_public_ip(self, name, resource_group, location=None):

    if ((location is None) and self.default_location):
        location = self.default_location
    else:
        raise ValueError('location    is    required.')
    target = ('/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/publicIPAddresses/%s' % (self.subscription_id, resource_group, name))
    data = {'location': location.id, 'tags': {}, 'properties': {'publicIPAllocationMethod': 'Dynamic'}}
    r = self.connection.request(target, params={'api-version': '2015-06-15'}, data=data, method='PUT')
    return self._to_ip_address(r.object)
