def _create_session(self, scope):
now = datetime.datetime.utcnow()<EOL>if self.session is None or self.expires_at is None or now >= self.expires_at:<EOL><INDENT>if self.session:<EOL><INDENT>self.session.close()<EOL><DEDENT>oauth_access_token, expires_at = self._get_oauth_access_token(<EOL>self.enterprise_configuration.key,<EOL>self.enterprise_configuration.secret,<EOL>self.enterprise_configuration.degreed_user_id,<EOL>self.enterprise_configuration.degreed_user_password,<EOL>scope<EOL>)<EOL>session = requests.Session()<EOL>session.timeout = self.SESSION_TIMEOUT<EOL>session.headers['<STR_LIT>'] = '<STR_LIT>'.format(oauth_access_token)<EOL>session.headers['<STR_LIT>'] = '<STR_LIT:application/json>'<EOL>self.session = session<EOL>self.expires_at = expires_at<EOL><DEDENT>
Instantiate a new session object for use in connecting with Degreed