code: def test_from_dict():
      assert from_dict(good_vpc_config) == (subnets, security_groups)
      assert from_dict(foo_vpc_config) == (subnets, security_groups)
  
      assert from_dict(None) == (None, None)
      assert from_dict(None, do_sanitize=True) == (None, None)
  
      with pytest.raises(KeyError):
          from_dict({})
      with pytest.raises(KeyError):
          from_dict({SUBNETS_KEY: subnets})
      with pytest.raises(KeyError):
          from_dict({SECURITY_GROUP_IDS_KEY: security_groups})
  
      with pytest.raises(ValueError):
          from_dict({}, do_sanitize=True)
  
imports: from __future__ import absolute_import
  import pytest
  from sagemaker.vpc_utils import SUBNETS_KEY, SECURITY_GROUP_IDS_KEY, to_dict, from_dict, sanitize
label_desc: Use image node_id 2 for calling a global function with example usage: test_from_dict() without return types