\sloppy
\setlength{\headsep}{3ex}
\setlength{\parindent}{0.0in}
\setlength{\parskip}{1.7ex plus 0.5ex minus 0.5ex}
\renewcommand{\baselinestretch}{1.02}
\setlength{\topsep}{-0.0\parskip}
\setlength{\partopsep}{-0.5\parskip}
\setlength{\itemindent}{0.0in}
\setlength{\listparindent}{0.0in}
\makeatletter
\renewcommand{\section}{\@startsection
{section} {1} {0mm}
{-3.5ex \@plus -1ex \@minus -.2ex}
{0.7ex \@plus.2ex}
{\normalfont\Large\bfseries}}
\renewcommand\subsection{\@startsection {subsection}{2}{0mm}
{-3.25ex\@plus -1ex \@minus -.2ex}
{0.3ex \@plus .2ex}
{\normalfont\large\bfseries}}
\renewcommand\subsubsection{\@startsection {subsubsection}{3}{0mm}
{-3.25ex\@plus -1ex \@minus -.2ex}
{0.3ex \@plus .2ex}
{\normalfont\normalsize\bfseries}}
\renewcommand{\l@section}{\@dottedtocline{1}{1.5em}{3.0em}}
\setcounter{tocdepth}{1}
\makeatother
\newcommand{\adjustpage}[1]{\enlargethispage{#1\baselineskip}}
\newcommand{\clearemptydoublepage}{\cleardoublepage}
\newcommand{\blankpage}{\vspace*{1in}\newpage}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}{}}
\lhead[\fancyplain{}{\bfseries\thepage}]
{\fancyplain{}{\bfseries\rightmark}}
\rhead[\fancyplain{}{\bfseries\leftmark}]
{\fancyplain{}{\bfseries\thepage}}
\cfoot{}
\pagestyle{fancyplain}
\definecolor{bgcolor}{HTML}{FAFAFA}
\definecolor{comment}{HTML}{007C00}
\definecolor{keyword}{HTML}{0000FF}
\definecolor{strings}{HTML}{B20000}
\lstset{
language=python,
basicstyle=\ttfamily,
backgroundcolor=\color{bgcolor},
commentstyle=\color{comment},
keywordstyle=\color{keyword},
stringstyle=\color{strings},
columns=fullflexible,
emph={label},
keepspaces=true,
showstringspaces=false,
upquote=true,
xleftmargin=15pt,
framexleftmargin=3pt,
aboveskip=\parskip,
belowskip=\parskip
}
\lstnewenvironment{code}
{\minipage{\linewidth}}
{\endminipage}
\lstnewenvironment{stdout}
{\lstset{commentstyle=,keywordstyle=,stringstyle=}\minipage{\linewidth}}
{\endminipage}
\newcommand{\py}[1]{\lstinline{#1}}
\renewcommand\MakeUppercase{}
\newtheoremstyle{myex}
{9pt}
{9pt}
{}
{}
{\bfseries}
{}
{0.5em}
{}
\theoremstyle{myex}