def idref_deprecated(entity):
    if not getattr(entity, 'idref', None):
        return

    fmt = ("The use of idrefs has been deprecated for this field. "
           "Received '{0}' object with idref: '{1}'.")

    msg = fmt.format(type(entity).__name__, entity.idref)
    warnings.warn(msg)
Add an optional metadata type to a document type.
dataset/ETHPy150Open STIXProject/python-stix/stix/utils/deprecated.py/idref_deprecated--crossover with--dataset/ETHPy150Open mayan-edms/mayan-edms/mayan/apps/metadata/api_views.py/APIDocumentTypeMetadataTypeOptionalListView.post