The only difference between a Lagrange and DG basis function is that there are duplicate entries in the dofmap (for every dof on a vertex, edge or facet), causing discontinuity for DG.
For basis functions, you can consider DefElement: DefElement or symfem
The basis functions will Also depend on the placement of the dofs, see:
https://docs.fenicsproject.org/dolfinx/v0.5.0/python/demos/demo_lagrange_variants.html