import pathlib


def fix_path(filepath: str, curr_dir=None) -> str:
    """Correct relative file paths regardless of where execution starts.
    Allows one to use source files in IDEs and DVC pipelines."""
    if not curr_dir:
        curr_dir = pathlib.Path(__file__).parent.resolve()
    new_dir = curr_dir / filepath
    return str(new_dir.resolve())