'Create the `discogs_client` field. Authenticate if necessary.'

def setup(self, session=None):

    c_key = self.config['apikey'].as_str()
    c_secret = self.config['apisecret'].as_str()
    user_token = self.config['user_token'].as_str()
    if user_token:
        self.discogs_client = Client(USER_AGENT, user_token=user_token)
        return
    try:
        with open(self._tokenfile()) as f:
            tokendata = json.load(f)
    except IOError:
        (token, secret) = self.authenticate(c_key, c_secret)
    else:
        token = tokendata['token']
        secret = tokendata['secret']
    self.discogs_client = Client(USER_AGENT, c_key, c_secret, token, secret)
