Create Record instance based on parameters.

    :param int level: Record level number.
    :param str xref_id: Record reference ID, possibly empty.
    :param str tag: Tag name.
    :param value: Record value, possibly empty. Value can be None, bytes, or
        string object, if it is bytes then it should be decoded into strings
        before calling freeze(), this is normally done by the parser which
        knows about encodings.
    :param list sub_records: Initial list of subordinate records,
        possibly empty. List can be updated later.
    :param int offset: Record location in a file.
    :param dialect: One of DIALECT_* constants.
    :param parser: Instance of `GedcomReader` class, only needed for
        records whose walue is a pointer.
    :return: Instance of :py:class:`Record` (or one of its subclasses).

def make_record(level, xref_id, tag, value, sub_records, offset, dialect,
                parser=None):
    """Create Record instance based on parameters.

    :param int level: Record level number.
    :param str xref_id: Record reference ID, possibly empty.
    :param str tag: Tag name.
    :param value: Record value, possibly empty. Value can be None, bytes, or
        string object, if it is bytes then it should be decoded into strings
        before calling freeze(), this is normally done by the parser which
        knows about encodings.
    :param list sub_records: Initial list of subordinate records,
        possibly empty. List can be updated later.
    :param int offset: Record location in a file.
    :param dialect: One of DIALECT_* constants.
    :param parser: Instance of `GedcomReader` class, only needed for
        records whose walue is a pointer.
    :return: Instance of :py:class:`Record` (or one of its subclasses).
    """
    # value can be bytes or string so we check for both, 64 is code for '@'
    if value and len(value) > 2 and \
        ((value[0] == '@' and value[-1] == '@') or
         (value[0] == 64 and value[-1] == 64)):
        # this looks like a <pointer>, make a Pointer record
        klass = Pointer
        rec = klass(parser)
    else:
        klass = _tag_class.get(tag, Record)
        rec = klass()

    rec.level = level
    rec.xref_id = xref_id
    rec.tag = tag
    rec.value = value
    rec.sub_records = sub_records
    rec.offset = offset
    rec.dialect = dialect
    return rec