'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 (driver specific). (optional)
:type extra: ``dict``
:rtype: :class:`Record`'

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

    extra = (extra or {})
    ret_record = None
    old_records_list = self.list_records(zone=zone)
    for record in old_records_list:
        if ((record.name == name) and (record.data == data)):
            raise RecordAlreadyExistsError(value='', driver=self, record_id=record.id)
    MX = self.RECORD_TYPE_MAP.get('MX')
    SRV = self.RECORD_TYPE_MAP.get('SRV')
    if (extra and extra.get('priority')):
        priority = int(extra['priority'])
    post_data = {'domain': zone.domain, 'name': name, 'type': self.RECORD_TYPE_MAP.get(type), 'data': data}
    if ((type == MX) or (type == SRV)):
        post_data['priority'] = priority
    encoded_data = urlencode(post_data)
    params = {'api_key': self.key}
    action = '/v1/dns/create_record'
    self.connection.request(action=action, params=params, data=encoded_data, method='POST')
    updated_zone_records = zone.list_records()
    for record in updated_zone_records:
        if ((record.name == name) and (record.data == data)):
            ret_record = record
    return ret_record
