labscript_utils.dedent

labscript_utils.dedent(s)[source]

Remove leading spaces from the first line of a string, all common leading indentation (spaces only) from subsequent lines, strip trailing spaces from all lines and replace single newlines prior to lines with the common indentation with spaces. Lines with additional indentation are kept verbatim. Good for unwrapping error messages etc that are in code as multiline triple-quoted strings.