While a lambda is still processing (archive unpacking etc), the lambda state should be set to "Pending" (currently "Active") and invocations to that lambda should fail (currently, it can end up in a inconsistent state in this case, like lambdas being executed without layers).

Lambda state should reflect the current internal state, and invocations should fail if not active.
if obj.startswith("arn:aws:kinesis:"):
            inst = KinesisStream(obj)
        elif obj.startswith("arn:aws:lambda:"):
            inst = LambdaFunction(obj)
        elif obj.startswith("arn:aws:dynamodb:"):
            if "/stream/" in obj:
                table_id = obj.split("/stream/")[0]
                table = DynamoDB(table_id)
                inst = DynamoDBStream(obj)
                inst.table = table
            else:
                inst = DynamoDB(obj)
        elif obj.startswith("arn:aws:sqs:"):
            inst = SqsQueue(obj)
        elif obj.startswith("arn:aws:sns:"):
            inst = SnsTopic(obj)
        elif type:
            for o in EventSource.filter_type(pool, type):
                if o.name() == obj:
                    return o
                if type == ElasticSearch:
                    if o.endpoint == obj:
                        return o
        else:
            print("Unexpected object name: '%s'" % obj)
        return inst
    @staticmethod
    def filter_type(pool, type):
        return [obj for obj in pool.values() if isinstance(obj, type)]