def insert_ark(cnx, naan, name, qualifier=None):
    """Insert a record in "ark" table from specified values."""
    if qualifier is None:
        qs = 'INSERT INTO ark VALUES (%s, %s) RETURNING naan, name, qualifier;'
        values = naan, name
    else:
        qs = (
            'INSERT INTO ark VALUES (%s, %s, %s) RETURNING naan, name, qualifier;'
            )
        values = naan, name, qualifier
    (naan, name, qualifier), = cnx.system_sql(qs, values).fetchall()
    ark = u'/'.join([str(naan), name])
    if qualifier:
        ark += u'/' + qualifier
    return ark
