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.
return "Shard(%s, length=%s, percent=%s, start=%s, end=%s)" % (
            self.id,
            self.length(),
            self.percent(),
            self.start_key,
            self.end_key,
        )
    @staticmethod
    def sort(shards):
        def compare(x, y):
            s1 = int(x.start_key)
            s2 = int(y.start_key)
            if s1 < s2:
                return -1
            elif s1 > s2:
                return 1
            else:
                return 0
        return sorted(shards, cmp=compare)
    @staticmethod
    def max(shards):
        max_shard = None
        max_length = int(0)
        for s in shards:
            if s.length() > max_length:
                max_shard = s
                max_length = s.length()
        return max_shard
class FirehoseStream(KinesisStream):