Grab twitter credential from settings

def twitter_credential(name):
    """ Grab twitter credential from settings """
    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)