code: def update_thing_shadow(self, thing_name, payload):
          
          thing = iot_backends[self.region_name].describe_thing(thing_name)
  
          # validate
          try:
              payload = json.loads(payload)
          except ValueError:
              raise InvalidRequestException('invalid json')
          if 'state' not in payload:
              raise InvalidRequestException('need node `state`')
          if not isinstance(payload['state'], dict):
              raise InvalidRequestException('state node must be an Object')
          if any(_ for _ in payload['state'].keys() if _ not in ['desired', 'reported']):
              raise InvalidRequestException('State contains an invalid node')
  
          new_shadow = FakeShadow.create_from_previous_version(thing.thing_shadow, payload)
          thing.thing_shadow = new_shadow
          return thing.thing_shadow
docs: spec of payload:
            - need node `state`
            - state node must be an Object
            - State contains an invalid node: 'foo'