@classmethod<EOL><INDENT>def to_record(cls, attr_names, values):<DEDENT>
try:<EOL><INDENT>values = values._asdict()<EOL><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>return [cls.__to_sqlite_element(values.get(attr_name)) for attr_name in attr_names]<EOL><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>if isinstance(values, (tuple, list)):<EOL><INDENT>return [cls.__to_sqlite_element(value) for value in values]<EOL><DEDENT>raise ValueError("<STR_LIT>".format(type(values)))<EOL>
Convert values to a record to be inserted into a database.

:param list attr_names:
    List of attributes for the converting record.
:param values: Values to be converted.
:type values: |dict|/|namedtuple|/|list|/|tuple|
:raises ValueError: If the ``values`` is invalid.