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 not self.conn:
            raise Exception("Please create the Kinesis connection first.")
        s_iterator = self.conn.get_shard_iterator(self.stream_name, shard, "TRIM_HORIZON")
        record = self.conn.get_records(s_iterator["ShardIterator"])
        while True:
            try:
                if record["NextShardIterator"] is None:
                    break
                else:
                    next_entry = self.conn.get_records(record["NextShardIterator"])
                    if len(next_entry["Records"]):
                        print(next_entry["Records"][0]["Data"])
                    record = next_entry
            except Exception as e:
                print('Error reading from Kinesis stream "%s": %s' % (self.stream_name, e))
    def wait_for(self):
        GET_STATUS_SLEEP_SECS = 5
        GET_STATUS_RETRIES = 50
        for i in range(0, GET_STATUS_RETRIES):
            try:
                status = self.get_status()
                if status == "ACTIVE":
                    return
            except Exception:
                
                pass
            time.sleep(GET_STATUS_SLEEP_SECS)
        raise Exception('Failed to get active status for stream "%s", giving up' % self.stream_name)
    def destroy(self):