def align_left(text, length, left_edge='|', right_edge='|', text_length=None, left_padding=2):
 if (text_length is None):
  text_length = get_text_length(text)
 computed_length = (((text_length + left_padding) + get_text_length(left_edge)) + get_text_length(right_edge))
 if ((length - computed_length) >= 0):
  padding = left_padding
 else:
  padding = 0
 output = []
 length_so_far = 0
 output.append(left_edge)
 length_so_far += len(left_edge)
 output.append((' ' * padding))
 length_so_far += padding
 output.append(text)
 length_so_far += text_length
 output.append((' ' * ((length - length_so_far) - len(right_edge))))
 output.append(right_edge)
 return ''.join(output)

def align_left ( text , length , left_edge = '|' , right_edge = '|' , text_length = None , left_padding = 2 ) : if ( text_length is None ) : text_length = get_text_length ( text ) computed_length = ( ( ( text_length + left_padding ) + get_text_length ( left_edge ) ) + get_text_length ( right_edge ) ) if ( ( length - computed_length ) >= 0 ) : padding = left_padding else : padding = 0 output = [ ] length_so_far = 0 output . append ( left_edge ) length_so_far += len ( left_edge ) output . append ( ( ' ' * padding ) ) length_so_far += padding output . append ( text ) length_so_far += text_length output . append ( ( ' ' * ( ( length - length_so_far ) - len ( right_edge ) ) ) ) output . append ( right_edge ) return '' . join ( output )
left align text .