code: def twitter_credential(name):
      
      credential_name = 'TWITTER_' + name.upper()
      if hasattr(settings, credential_name):
          return getattr(settings, credential_name)
      else:
          raise AttributeError('Missing twitter credential in settings: ' + credential_name)
docs: Grab twitter credential from settings