def get_current_filename() -> Optional[str]:
    """Returns the filename of the current file.

    It will try to get the filename from the following sources:
    - __file__ variable (only works when running from python)
    - __vsc_ipynb_file__ variable (only works when running from vscode)
    - ipynbname.name() (only works when running from a notebook/gooble colab)
    - None if it can't be determined
    """
    from pathlib import Path

    try:
        try:
            # Should work if we are running from python
            return Path(__file__).stem
        except NameError:
            # This should work if we are running a notebook from vscode
            globals_ = globals()
            return Path(globals_["__vsc_ipynb_file__"]).stem
    except KeyError:
        # This should work for notebooks running locally or using google colab
        import urllib.parse

        import ipynbname

        return Path(urllib.parse.unquote_plus(ipynbname.name())).stem
Returns the filename of the current file.

    It will try to get the filename from the following sources:
    - __file__ variable (only works when running from python)
    - __vsc_ipynb_file__ variable (only works when running from vscode)
    - ipynbname.name() (only works when running from a notebook/gooble colab)
    - None if it can't be determined
    
argilla-v1/src/argilla_v1/utils/telemetry.py