def format(string, params=None, strip=True, indent=None):
 output = string
 if (output.find(u'\n') != (-1)):
  output = dedent(output)
 if ((output[0] == u'\n') and (output[1] != u'\n')):
  output = output[1:]
 if (output.find(u'\n') != (-1)):
  output = re.sub(u'(?<=\\S)\n(?=[^ \n DCTB \\d\\*\\-=])', u' ', output)
 if ((output[(-1)] == u'\n') and strip and (output[(-2)] != u'\n')):
  output = output[0:(-1)]
 if (params is not None):
  output = (output % params)
 if (indent is not None):
  output = (indent + output.replace(u'\n', (u'\n' + indent)))
 return output

def format ( string , params = None , strip = True , indent = None ) : output = string if ( output . find ( u'\n' ) != ( - 1 ) ) : output = dedent ( output ) if ( ( output [ 0 ] == u'\n' ) and ( output [ 1 ] != u'\n' ) ) : output = output [ 1 : ] if ( output . find ( u'\n' ) != ( - 1 ) ) : output = re . sub ( u'(?<=\\S)\n(?=[^ \n DCTB \\d\\*\\-=])' , u' ' , output ) if ( ( output [ ( - 1 ) ] == u'\n' ) and strip and ( output [ ( - 2 ) ] != u'\n' ) ) : output = output [ 0 : ( - 1 ) ] if ( params is not None ) : output = ( output % params ) if ( indent is not None ) : output = ( indent + output . replace ( u'\n' , ( u'\n' + indent ) ) ) return output
format a provided datetime object and return iso8601 string .