#NEWLINE# def CreateCGate( name , latexname = None ) : #NEWLINE# #INDENT# 'Use a lexical closure to make a controlled gate.\n    ' #NEWLINE# if ( not latexname ) : #NEWLINE# #INDENT# latexname = name #NEWLINE# #UNINDENT# onequbitgate = CreateOneQubitGate ( name , latexname ) #NEWLINE# def ControlledGate( ctrls , target ) : #NEWLINE# #INDENT# return CGate ( tuple ( ctrls ) , onequbitgate ( target ) ) #NEWLINE# #UNINDENT# return ControlledGate