parameters: (self, jid, new, ask=None)
return_statement: return self._updated(state, ask=ask, subscription=new)
docstring: Update roster state to reflect changes in the state of a
          subscription request.
docstring_summary: Update roster state to reflect changes in the state of a
          subscription request.
docstring_tokens: Update roster state to reflect changes in the state of a subscription request .
function: def subscribe(self, jid, new, ask=None):
          """Update roster state to reflect changes in the state of a
          subscription request."""
  
          state = self._get(jid)
          old = state.attr.get('subscription')
          if old is None:
              pass
          elif new == 'none':
              new = old
          elif ((new == 'to' and old == 'from')
                or (new == 'from' and old == 'to')):
              new = 'both'
          return self._updated(state, ask=ask, subscription=new)
function_tokens: def subscribe ( self , jid , new , ask = None ) : state = self . _get ( jid ) old = state . attr . get ( 'subscription' ) if old is None : pass elif new == 'none' : new = old elif ( ( new == 'to' and old == 'from' ) or ( new == 'from' and old == 'to' ) ) : new = 'both' return self . _updated ( state , ask = ask , subscription = new )