code: def exists_locked(filepath: str) -> Tuple[bool, bool]:
      
      exists = False
      locked = None
      file_object = None
      if os.path.exists(filepath):
          exists = True
          locked = True
          try:
              buffer_size = 8
              # Opening file in append mode and read the first 8 characters.
              file_object = open(filepath, 'a', buffer_size)
              if file_object:
                  locked = False  # exists and not locked
          except IOError:
              pass
          finally:
              if file_object:
                  file_object.close()
      return exists, locked
docs: Checks if a file is locked by opening it in append mode.
      (If no exception is thrown in that situation, then the file is not locked.)
  
      Args:
          filepath: file to check
  
      Returns:
          tuple: ``(exists, locked)``
  
      See https://www.calazan.com/how-to-check-if-a-file-is-locked-in-python/.