private bool LoadTypeInPython(Type type)
        {
            if (type.IsGenericType ||                                                                  // Not a generic type (requires special handling).
                !type.IsPublic ||                                                                      // Not a public type.
                //type.IsAbstract && !type.IsSealed || // Not an abstract type. We check for IsSealed because a static class is considered to be abstract AND sealed.
                type.DeclaringType != null ||                                                          // IronPython does not support importing nested classes.
                TypeFilters.Any(x => x.Equals(type.Name, PythonInterpreter.StringComparisonMethod)) || // Not filtered.
                !_addedTypes.Add(type))                                                                // Not already added.
            {
                return(false);
            }

            var assemblyName = type.Assembly.GetName().Name;

            if (_referencedAssemblies.Add(assemblyName))
            {
                _interpreter.RunScript($"clr.AddReference('{assemblyName}')");
            }

            // While not required on Windows platform, the type system used by the Mono runtime seems to
            // slightly differ, providing occasional primitive type names with an ampersand (&) suffix (ref type?).
            // We simply remove that suffix, since we want to load the type itself and do not care about ref/val differences.
            // That means that we potentially may load a type twice, but this is not an issue - just a very minor perf overhead.
            // Ref: https://github.com/discosultan/quake-console/issues/6
            string sanitizedTypeName = type.Name.TrimEnd(StrippablePythonTypeNameChars);

            string script = $"from {type.Namespace} import {sanitizedTypeName}";

            _interpreter.RunScript(script);

            return(true);
        }
        private bool LoadTypeInPython(Type type)
        {
            if (type.IsGenericType ||                                                                  // Not a generic type (requires special handling).
                !type.IsPublic ||                                                                      // Not a public type.
                //type.IsAbstract && !type.IsSealed || // Not an abstract type. We check for IsSealed because a static class is considered to be abstract AND sealed.
                type.DeclaringType != null ||                                                          // IronPython does not support importing nested classes.
                TypeFilters.Any(x => x.Equals(type.Name, PythonInterpreter.StringComparisonMethod)) || // Not filtered.
                !_addedTypes.Add(type))                                                                // Not already added.
            {
                return(false);
            }

            var assemblyName = type.Assembly.GetName().Name;

            if (_referencedAssemblies.Add(assemblyName))
            {
                _interpreter.RunScript("clr.AddReference('" + assemblyName + "')");
            }

            string script = "from " + type.Namespace + " import " + type.Name;

            _interpreter.RunScript(script);

            return(true);
        }