def METHOD_NAME(self, edit, ev):
    """Return None, False or True.
    None when Home was not pressed,
    True when the event was handled,
    False when the event was not handled and should be handled normally.
    """
    home = ev.matches(QKeySequence.MoveToStartOfLine)
    s_home = ev.matches(QKeySequence.SelectStartOfLine)
    if home or s_home:
        # go to first non-space character if not already there
        cursor = edit.textCursor()
        text = cursor.block().text()
        pos = cursor.block().position() + len(text) - len(text.lstrip())
        if cursor.position() != pos:
            mode = QTextCursor.KeepAnchor if s_home else QTextCursor.MoveAnchor
            cursor.setPosition(pos, mode)
            edit.setTextCursor(cursor)
            return True
        return False