<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def new_floating_ip(self, **kwargs):
 """ Creates a Floating IP and assigns it to a Droplet or reserves it to a region. """

        droplet_id = kwargs.get('droplet_id')
        region = kwargs.get('region')

        if self.api_version == 2:
            if droplet_id is not None and region is not None:
                raise DoError('Only one of droplet_id and region is required to create a Floating IP. ' \
                    'Set one of the variables and try again.')
            elif droplet_id is None and region is None:
                raise DoError('droplet_id or region is required to create a Floating IP. ' \
                    'Set one of the variables and try again.')
            else:
                if droplet_id is not None:
                    params = {'droplet_id': droplet_id}
                else:
                    params = {'region': region}

                json = self.request('/floating_ips', params=params, method='POST')
                return json['floating_ip']
        else:
            raise DoError(v2_api_required_str)