def _format_align(body, spec_dict):
 if ((len(body) > 0) and (body[0] in '-+')):
  sign = body[0]
  body = body[1:]
 else:
  sign = ''
 if (sign != '-'):
  if (spec_dict['sign'] in ' +'):
   sign = spec_dict['sign']
  else:
   sign = ''
 minimumwidth = spec_dict['minimumwidth']
 fill = spec_dict['fill']
 padding = (fill * max((minimumwidth - len((sign + body))), 0))
 align = spec_dict['align']
 if (align == '<'):
  result = ((padding + sign) + body)
 elif (align == '>'):
  result = ((sign + body) + padding)
 elif (align == '='):
  result = ((sign + padding) + body)
 else:
  half = (len(padding) // 2)
  result = (((padding[:half] + sign) + body) + padding[half:])
 if spec_dict['unicode']:
  result = unicode(result)
 return result

def _format_align ( body , spec_dict ) : if ( ( len ( body ) > 0 ) and ( body [ 0 ] in '-+' ) ) : sign = body [ 0 ] body = body [ 1 : ] else : sign = '' if ( sign != '-' ) : if ( spec_dict [ 'sign' ] in ' +' ) : sign = spec_dict [ 'sign' ] else : sign = '' minimumwidth = spec_dict [ 'minimumwidth' ] fill = spec_dict [ 'fill' ] padding = ( fill * max ( ( minimumwidth - len ( ( sign + body ) ) ) , 0 ) ) align = spec_dict [ 'align' ] if ( align == '<' ) : result = ( ( padding + sign ) + body ) elif ( align == '>' ) : result = ( ( sign + body ) + padding ) elif ( align == '=' ) : result = ( ( sign + padding ) + body ) else : half = ( len ( padding ) // 2 ) result = ( ( ( padding [ : half ] + sign ) + body ) + padding [ half : ] ) if spec_dict [ 'unicode' ] : result = unicode ( result ) return result
given an unpadded .