'Create a record.
:param name: Record name without the domain name (e.g. www).
Note: If you want to create a record for a base domain
name, you should specify empty string (\'\') for this
argument.
:type  name: ``str``
:param zone: Zone which the records will be created for.
:type zone: :class:`Zone`
:param type: DNS record type ( \'A\', \'AAAA\', \'CNAME\', \'MX\', \'NS\',
\'PTR\', \'SOA\', \'SRV\', \'TXT\').
:type  type: :class:`RecordType`
:param data: Data for the record (depends on the record type).
:type  data: ``str``
:param extra: (optional) Extra attributes (\'prio\', \'ttl\').
:type  extra: ``dict``
:rtype: :class:`Record`'

def create_record(self, name, zone, type, data, extra=None):

    action = '/v1/Network/DNS/Record/create'
    to_post = {'params': {'name': name, 'rdata': data, 'type': type, 'zone': zone.domain, 'zone_id': zone.id}}
    if (extra is not None):
        to_post['params'].update(extra)
    data = json.dumps(to_post)
    try:
        response = self.connection.request(action=action, method='POST', data=data)
    except APIException:
        e = sys.exc_info()[1]
        if (e.error_class == 'LW::Exception::DuplicateRecord'):
            raise RecordAlreadyExistsError(record_id=name, value=e.value, driver=self)
        else:
            raise e
    record = self._to_record(response.objects[0], zone=zone)
    return record
