input: Write a function to delete a certain element from a linked list. The function should take in the node to be deleted as an argument. If the node is found and deleted successfully, the linked list should be modified accordingly. If the node is not found, the linked list should remain unchanged.
  
  
  class Node:
      def __init__(self, data):
          self.data = data
          self.next = None
  
  class LinkedList:
      def __init__(self):
          self.head = None
  
      def deleteNode(self, node):
          temp = self.head
  
          if temp is not None:
              if temp == node:
                  self.head = temp.next
                  temp = None
                  return
  
          while temp is not None:
              if temp == node:
                  break
              prev = temp
              temp = temp.next
  
          if temp == None:
              return
  
          prev.next = temp.next
          temp = None
  
  # Test cases
  llist = LinkedList()
  llist.head = Node(7)
  second = Node(1)
  third = Node(3)
  fourth = Node(2)
  llist.head.next = second
  second.next = third
  third.next = fourth
  
  # Test case 1
  llist.deleteNode(third)
  assert llist.head.next.next.data == 2
  
  # Test case 2
  llist.deleteNode(llist.head)
  assert llist.head.data == 1
  
  # Test case 3
  llist.deleteNode(fourth)
  assert llist.head.next.next == None
  
  # Test case 4
  llist.deleteNode(Node(5))
  assert llist.head.data == 1
  
output: def deleteNode(self, node):
      temp = self.head
  
      if temp is not None:
          if temp == node:
              self.head = temp.next
              temp = None
              return
  
      while temp is not None:
          if temp == node:
              break
          prev = temp
          temp = temp.next
  
      if temp == None:
          return
  
      prev.next = temp.next
      temp = None