#NEWLINE# def _makeBasicAuth( username , password ) : #NEWLINE# #INDENT# if ( username and username ) : #NEWLINE# #INDENT# return ( 'Basic ' + b64encode ( ( ( username + ':' ) + password ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( username or password ) : #NEWLINE# #INDENT# raise ValueError ( 'expecting both a username *and* password' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return None