def _spacing_preflight(func):
 def wrapped(self, width, fillchar=None):
  if (fillchar is None):
   fillchar = ' '
  if ((len(fillchar) != 1) or (not isinstance(fillchar, basestring))):
   raise TypeError(('must be char, not %s' % type(fillchar)))
  if (not isinstance(width, int)):
   raise TypeError(('integer argument expected, got %s' % type(width)))
  difference = (width - len(self))
  if (difference <= 0):
   return self
  return func(self, width, fillchar, difference)
 return wrapped

def _spacing_preflight ( func ) : def wrapped ( self , width , fillchar = None ) : if ( fillchar is None ) : fillchar = ' ' if ( ( len ( fillchar ) != 1 ) or ( not isinstance ( fillchar , basestring ) ) ) : raise TypeError ( ( 'must be char, not %s' % type ( fillchar ) ) ) if ( not isinstance ( width , int ) ) : raise TypeError ( ( 'integer argument expected, got %s' % type ( width ) ) ) difference = ( width - len ( self ) ) if ( difference <= 0 ) : return self return func ( self , width , fillchar , difference ) return wrapped
this wrapper function is used to do some preflight checks on functions used for padding ansistrings .