title: Right django decorator
body: <p>I have copied code of django decorator, and changed it for my purposes</p>
  
  <pre><code>def valid_token_required(function=None):
  
      def _dec(view_func):
          def _view(request, *args, **kwargs):
              if 'token' in request.session:
                  try:
                      conn = server.GetTokenCon(request.session['token'])
                      if conn.get_api_status().status == 'good':
                          kwargs['Connection'] = conn
                          return view_func(request, *args, **kwargs)
                  except RateLimitExceededException as e:
                      return HttpResponseForbidden('token_limit')
                  except BadCredentialsException as e:
                      return HttpResponseForbidden('badkey')
              return HttpResponseForbidden('require_token')
  
          _view.__name__ = view_func.__name__
          _view.__dict__ = view_func.__dict__
          _view.__doc__ = view_func.__doc__
  
          return _view
  
      if function is None:
          return _dec
      else:
          return _dec(function)
  </code></pre>
  
  <p>All is OK, but I can't understand the sense of this lines, I have tried to delete them and code continue work. Can somebody explain the meaning of this lines? </p>
  
  <pre><code>_view.__name__ = view_func.__name__
  _view.__dict__ = view_func.__dict__
  _view.__doc__ = view_func.__doc__
  </code></pre>