'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, MX, TXT).
:type  type: :class:`RecordType`
:param data: Data for the record (depends on the record type).
:type  data: ``str``
:param extra: Extra attributes (driver specific, e.g. \'ttl\').
(optional)
:type extra: ``dict``
:rtype: :class:`Record`'

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

    action = ('/dns/%s/addRR' % zone.domain)
    payload = {'name': name, 'data': data, 'type': type}
    if ((extra is not None) and (extra.get('ttl', None) is not None)):
        payload['ttl'] = extra['ttl']
    try:
        self.connection.request(action=action, data=payload, method='POST')
    except BaseHTTPError:
        e = sys.exc_info()[1]
        exists_re = re.compile('That    RR    already    exists    on    the    domain')
        if ((e.code == httplib.BAD_REQUEST) and (re.search(exists_re, e.message) is not None)):
            value = ('"%s"    already    exists    in    %s' % (name, zone.domain))
            raise RecordAlreadyExistsError(value=value, driver=self, record_id=None)
        raise e
    return self.ex_get_records_by(zone=zone, name=name, type=type)[0]
