':param name: Name of the record to create (e.g. foo).
:type name: ``str``
:param zone: Zone where the record should be created.
:type zone: :class:`Zone`
:param type: Type of record (e.g. A, MX etc)
:type type: ``str``
:param data: Data of the record (e.g. 127.0.0.1 for the A record)
:type data: ``str``
:param extra: Extra data needed to create different types of records
:type extra: ``dict``
:return: :class:`Record`'

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

    action = ('/v1/zones/%s/%s/%s' % (zone.domain, ('%s.%s' % (name, zone.domain)), type))
    raw_data = {'answers': [{'answer': [data]}], 'type': type, 'domain': ('%s.%s' % (name, zone.domain)), 'zone': zone.domain}
    if ((extra is not None) and extra.get('answers')):
        raw_data['answers'] = extra.get('answers')
    post_data = json.dumps(raw_data)
    try:
        response = self.connection.request(action=action, method='PUT', data=post_data)
    except NsOneException:
        e = sys.exc_info()[1]
        if (e.message == 'record    already    exists'):
            raise RecordAlreadyExistsError(value=e.message, driver=self, record_id='')
        else:
            raise e
    record = self._to_record(item=response.parse_body(), zone=zone)
    return record
