def METHOD_NAME(self, response, variable,
                    instance_of=None, value=None):
    try:
        instance = response.context[variable]
        self.assertTrue(instance)
    except KeyError:
        self.fail(
            'Asserted variable %s not in response context.' % variable
        )
    if instance_of:
        self.assertTrue(isinstance(instance, instance_of))
    if value:
        self.assertEqual(instance, value)