static PropertyDescriptor[] GetPropertiesImpl(object self, Attribute[] attributes)
        {
            IList <object>            attrNames = PythonOps.GetAttrNames(DefaultContext.DefaultCLS, self);
            List <PropertyDescriptor> descrs    = new List <PropertyDescriptor>();

            if (attrNames != null)
            {
                foreach (object o in attrNames)
                {
                    string s = o as string;
                    if (s == null)
                    {
                        continue;
                    }

                    PythonTypeSlot attrSlot = null;
                    object         attrVal;

                    if (self is OldInstance)
                    {
                        if (((OldInstance)self)._class.TryLookupSlot(s, out attrVal))
                        {
                            attrSlot = attrVal as PythonTypeSlot;
                        }
                        else if (!((OldInstance)self).Dictionary.TryGetValue(s, out attrVal))
                        {
                            attrVal = ObjectOps.__getattribute__(DefaultContext.DefaultCLS, self, s);
                        }
                    }
                    else
                    {
                        PythonType dt = DynamicHelpers.GetPythonType(self);
                        dt.TryResolveSlot(DefaultContext.DefaultCLS, s, out attrSlot);
                        attrVal = ObjectOps.__getattribute__(DefaultContext.DefaultCLS, self, s);
                    }

                    Type attrType = (attrVal == null) ? typeof(NoneTypeOps) : attrVal.GetType();

                    if ((attrSlot != null && ShouldIncludeProperty(attrSlot, attributes)) ||
                        (attrSlot == null && ShouldIncludeInstanceMember(s, attributes)))
                    {
                        descrs.Add(new SuperDynamicObjectPropertyDescriptor(s, attrType, self.GetType()));
                    }
                }
            }

            return(descrs.ToArray());
        }