#NEWLINE# def digest_auth( request , response , realm , users ) : #NEWLINE# #INDENT# 'Perform Digest Authentication\n\n    If auth fails, raise 401 with a digest authentication header.\n\n    :param realm: The authentication realm.\n    :type  realm: str\n\n    :param users: A dict of the form: {username: password} or a callable\n                  returning a dict.\n    :type  users: dict or callable\n    ' #NEWLINE# if check_auth ( request , request , realm , users ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# response . headers [ 'WWW-Authenticate' ] = _httpauth . digestAuth ( realm ) #NEWLINE# return unauthorized ( request , response )