@classmethod
def build_close_payload(cls, status, reason=''):
    """Build a close frame."""
    if not isinstance(reason, bytes):
        reason = reason.encode('utf-8', errors='replace')
    if status is None:
        return b''
    payload_bytes = cls._pack_close_code(status) + reason
    return payload_bytes
