code: def get_aws_session(account):
      
      from cloud_inquisitor.config import dbconfig
      from cloud_inquisitor.plugins.types.accounts import AWSAccount
  
      if not isinstance(account, AWSAccount):
          raise InquisitorError('Non AWSAccount passed to get_aws_session, got {}'.format(account.__class__.__name__))
  
      # If no keys are on supplied for the account, use sts.assume_role instead
      session = get_local_aws_session()
      if session.get_credentials().method in ['iam-role', 'env', 'explicit']:
          sts = session.client('sts')
      else:
          # If we are not running on an EC2 instance, assume the instance role
          # first, then assume the remote role
          temp_sts = session.client('sts')
  
          audit_sts_role = temp_sts.assume_role(
              RoleArn=app_config.aws_api.instance_role_arn,
              RoleSessionName='inquisitor'
          )
          sts = boto3.session.Session(
              audit_sts_role['Credentials']['AccessKeyId'],
              audit_sts_role['Credentials']['SecretAccessKey'],
              audit_sts_role['Credentials']['SessionToken']
          ).client('sts')
  
      role = sts.assume_role(
          RoleArn='arn:aws:iam::{}:role/{}'.format(
              account.account_number,
              dbconfig.get('role_name', default='cinq_role')
          ),
          RoleSessionName='inquisitor'
      )
  
      sess = boto3.session.Session(
          role['Credentials']['AccessKeyId'],
          role['Credentials']['SecretAccessKey'],
          role['Credentials']['SessionToken']
      )
  
      return sess
docs: Function to return a boto3 Session based on the account passed in the first argument.
  
      Args:
          account (:obj:`Account`): Account to create the session object for
  
      Returns:
          :obj:`boto3:boto3.session.Session`