def singleitem(attr=None, doc=''):
 def getter(self):
  if (len(self._items) > 1):
   raise ValueError('More than one HSPFragment objects found in HSP')
  if (attr is None):
   return self._items[0]
  return getattr(self._items[0], attr)
 return property(fget=getter, doc=doc)

def singleitem ( attr = None , doc = '' ) : def getter ( self ) : if ( len ( self . _items ) > 1 ) : raise ValueError ( 'More than one HSPFragment objects found in HSP' ) if ( attr is None ) : return self . _items [ 0 ] return getattr ( self . _items [ 0 ] , attr ) return property ( fget = getter , doc = doc )
returns a property that fetches the given attribute from the first item in a searchio container object .