'Create a new 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 where the requested record is created.
:type  zone: :class:`Zone`
:param type: DNS record type (A, AAAA, ...).
:type  type: :class:`RecordType`
:param data: Data for the record (depends on the record type).
:type  data: ``str``
:param extra: Extra attributes for MX and SRV. (Depends on record)
{"priority" : 0, "port" : 443, "weight" : 100}
:type extra: ``dict``
:rtype: :class:`Record`'

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

    params = {'type': self.RECORD_TYPE_MAP[type], 'name': name, 'data': data}
    if extra:
        try:
            params['priority'] = extra['priority']
        except KeyError:
            params['priority'] = 'null'
        try:
            params['port'] = extra['port']
        except KeyError:
            params['port'] = 'null'
        try:
            params['weight'] = extra['weight']
        except KeyError:
            params['weight'] = 'null'
    res = self.connection.request(('/v2/domains/%s/records' % zone.id), params=params, method='POST')
    return Record(id=res.object['domain_record']['id'], name=res.object['domain_record']['name'], type=type, data=data, zone=zone, driver=self, extra=extra)
