def Bastion(object, filter=(lambda name: (name[:1] != '_')), name=None, bastionclass=BastionClass):
 raise RuntimeError, 'This code is not secure in Python 2.2 and later'
 def get1(name, object=object, filter=filter):
  'Internal function for Bastion().  See source comments.'
  if filter(name):
   attribute = getattr(object, name)
   if (type(attribute) == MethodType):
    return attribute
  raise AttributeError, name
 def get2(name, get1=get1):
  'Internal function for Bastion().  See source comments.'
  return get1(name)
 if (name is None):
  name = repr(object)
 return bastionclass(get2, name)

def Bastion ( object , filter = ( lambda name : ( name [ : 1 ] != '_' ) ) , name = None , bastionclass = BastionClass ) : raise RuntimeError , 'This code is not secure in Python 2.2 and later' def get1 ( name , object = object , filter = filter ) : if filter ( name ) : attribute = getattr ( object , name ) if ( type ( attribute ) == MethodType ) : return attribute raise AttributeError , name def get2 ( name , get1 = get1 ) : return get1 ( name ) if ( name is None ) : name = repr ( object ) return bastionclass ( get2 , name )
create a bastion for an object .