Prepare to store data from user-desired optional fields.

          Not loading these optional fields by default saves in space and speed.
          But allow the possibility for saving these fields, if the user desires,
            Including:
              comment consider def is_class_level is_metadata_tag is_transitive
              relationship replaced_by subset synonym transitive_over xref

def get_optional_attrs(optional_attrs):
        """Prepare to store data from user-desired optional fields.

          Not loading these optional fields by default saves in space and speed.
          But allow the possibility for saving these fields, if the user desires,
            Including:
              comment consider def is_class_level is_metadata_tag is_transitive
              relationship replaced_by subset synonym transitive_over xref
        """
        attrs_opt = set(['def', 'defn', 'synonym', 'relationship', 'xref', 'subset', 'comment'])
        # Required attributes are always loaded. All others are optionally loaded.
        # Allow user to specify either: 'def' or 'defn'
        #   'def' is an obo field name, but 'defn' is legal Python attribute name
        getnm = lambda aopt: aopt if aopt != "defn" else "def"
        # pylint: disable=redefined-variable-type
        opts = None
        if isinstance(optional_attrs, str) and optional_attrs in attrs_opt:
            opts = set([getnm(optional_attrs)])
        else:
            opts = set([getnm(f) for f in optional_attrs if f in attrs_opt])
        if opts:
            return opts