input: Write a function to delete a certain element from a linked list. The function should take the node to be deleted as an argument and remove it from the linked list, re-linking the previous node to the next node if necessary. If the node to be deleted is not present in the list, the function should do nothing.
  
  
  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
  linked_list = LinkedList()
  linked_list.head = Node(1)
  second = Node(2)
  third = Node(3)
  fourth = Node(4)
  linked_list.head.next = second
  second.next = third
  third.next = fourth
  
  # Delete the second node
  assert linked_list.deleteNode(second) == None
  # Assert the linked list after deletion
  current = linked_list.head
  assert current.data == 1
  current = current.next
  assert current.data == 3
  current = current.next
  assert current.data == 4
  
  # Try to delete a node that doesn't exist
  assert linked_list.deleteNode(Node(5)) == None
  # Assert the linked list remains unchanged
  current = linked_list.head
  assert current.data == 1
  current = current.next
  assert current.data == 3
  current = current.next
  assert current.data == 4
  
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