def METHOD_NAME(cls, parse_data, top=None):
    refid = getattr(parse_data, 'refid', None)
    if refid is not None and top is not None and refid in top._refs:
        return top._refs[refid]
    inst = cls(parse_data, top=top)
    if refid is not None:
        inst.refid = refid
        inst.add_ref(inst)
    return inst