code: def element(self, inp=None, order=None, **kwargs):
          
          if inp is None:
              return self.element_type(self, self.tspace.element(order=order))
          elif inp in self and order is None:
              return inp
          elif callable(inp):
              sampled = self.sampling(inp, **kwargs)
              return self.element_type(self,
                                       self.tspace.element(sampled, order=order))
          else:
              return self.element_type(self,
                                       self.tspace.element(inp, order=order))
docs: Create an element from ``inp`` or from scratch.
  
          Parameters
          ----------
          inp : optional
              Input data to create an element from. It needs to be
              understood by either the `sampling` operator of this
              instance or by its ``tspace.element`` method.
          order : {None, 'C', 'F'}, optional
              Storage order of the returned element. For ``'C'`` and ``'F'``,
              contiguous memory in the respective ordering is enforced.
              The default ``None`` enforces no contiguousness.
          kwargs :
              Additional arguments passed on to `sampling` when called
              on ``inp``, in the form ``sampling(inp, **kwargs)``.
              This can be used e.g. for functions with parameters.
  
          Returns
          -------
          element : `DiscretizedSpaceElement`
              The discretized element, calculated as ``sampling(inp)`` or
              ``tspace.element(inp)``, tried in this order.
  
          See Also
          --------
          sampling : create a discrete element from a non-discretized one