code: def build_from_bases(bases, classdict, attr, attr_dict):
      
      output = OrderedDict()
      output_keys = set()
      all_bases = []
      # Go through the bases from furthest to nearest ancestor
      for base in reversed(bases):
          # Only keep the items that are still defined on the bases
          if base is not object and isinstance(base, PropertyMetaclass):
              output_keys = output_keys.union(getattr(base, attr))
          # Collect all bases so we ensure overridden items are assigned
          # in the correct order
          for item in reversed(base.__mro__):
              if item is object or not isinstance(item, PropertyMetaclass):
                  continue
              if item not in all_bases:
                  all_bases.append(item)
      # Update the items in reverse MRO order; only keep those that are
      # defined on the bases
      for base in all_bases:
          for key, val in iteritems(getattr(base, attr)):
              if key in base.__dict__ and key in output_keys:
                  output.update({key: val})
      # Remove all items that were overridden by this class; this is
      # potentially a superset of the items added back in the next step.
      for key in classdict:
          if key in output:
              output.pop(key)
      # Update the items with those defined on this class
      output.update(attr_dict)
      return output
docs: Helper function to build private HasProperties attributes