code: def samdb_connect():
      
      with root():
          lp = samba.param.LoadParm()
      lp.load("/etc/samba/smb.conf")
      creds = Credentials()
      creds.guess(lp)
      session = system_session()
      samdb = SamDB("/var/lib/samba/private/sam.ldb",
                    session_info=session,
                    credentials=creds,
                    lp=lp)
      return samdb
docs: Open and return a SamDB connection