def append_token(url, token):
 if token:
  url += ('?' + urlencode({'X-Plex-Token': token}))
 return url

def append_token ( url , token ) : if token : url += ( '?' + urlencode ( { 'X-Plex-Token' : token } ) ) return url
appends the plex home token to the api call if required .