'Return a copy of this set.'

def copy(self):

    context = self._context
    builder = self._builder
    payload = self.payload
    used = payload.used
    fill = payload.fill
    other = type(self)(context, builder, self._ty, None)
    no_deleted_entries = builder.icmp_unsigned('==', used, fill)
    with builder.if_else(no_deleted_entries, likely=True) as (if_no_deleted, if_deleted):
        with if_no_deleted:
            ok = other._copy_payload(payload)
            with builder.if_then(builder.not_(ok), likely=False):
                context.call_conv.return_user_exc(builder, MemoryError, ('cannot    copy    set',))
        with if_deleted:
            nentries = self.choose_alloc_size(context, builder, used)
            ok = other._allocate_payload(nentries)
            with builder.if_then(builder.not_(ok), likely=False):
                context.call_conv.return_user_exc(builder, MemoryError, ('cannot    copy    set',))
            other_payload = other.payload
            with payload._iterate() as loop:
                entry = loop.entry
                other._add_key(other_payload, entry.key, entry.hash, do_resize=False)
    return other
