def unIndentBlock(block):
            currentIndent = blockIndentation(block)

            if currentIndent.endswith('\t'):
                charsToRemove = 1
            elif withSpace:
                charsToRemove = 1 if currentIndent else 0
            else:
                if self.useTabs:
                    charsToRemove = min(spacesCount(currentIndent), self.width)
                else:  # spaces
                    if currentIndent.endswith(self.text()):  # remove indent level
                        charsToRemove = self.width
                    else:  # remove all spaces
                        charsToRemove = min(spacesCount(currentIndent), self.width)

            if charsToRemove:
                cursor = cursorAtSpaceEnd(block)
                cursor.setPosition(cursor.position() - charsToRemove, QTextCursor.KeepAnchor)
                cursor.removeSelectedText()
def post(txt, contact, parenttype=None, notify=False, subject=None):
	"""post message"""

	d = frappe.new_doc('Communication')
	d.communication_type = 'Notification' if parenttype else 'Chat'
	d.subject = subject
	d.content = txt
	d.reference_doctype = 'User'
	d.reference_name = contact
	d.sender = frappe.session.user
	d.insert(ignore_permissions=True)

	delete_notification_count_for("Messages")

	if notify and cint(notify):
		if contact==frappe.session.user:
			_notify([user.name for user in get_enabled_system_users()], txt)
		else:
			_notify(contact, txt, subject)

	return d