@staticmethod
def strip_indent(docstr):
    """Remove common leading indentation from docstring.

        Determine indentation level of line with least amount of leading
        whitespace (of the lines with non-whitespace characters). Dedent
        all docstring lines by that amount.

        :returns: normalized docstring
        :rtype: str

        """
    if '\n' in docstr:
        lines = docstr.split('\n')
        indents = []
        for line in lines[1:]:
            unindented_line = line.lstrip()
            if unindented_line:
                indents.append(len(line) - len(unindented_line))
        if indents:
            indent = min(indents)
        else:
            indent = 0
        lines[1:] = [line[indent:] for line in lines[1:]]
        docstr = '\n'.join(lines)
    return docstr
