from pathlib import Path


def create_folder(folder_name, folder_path=""):
    """
    Create a folder with a given name in a given path.
    Also creates all non-existing parent folders.

    Parameters
    ----------
    folder_name : str
        Name of the folder to be created.
    folder_path : str
        Optional; default: current path.
        Either relative or absolute path of the folder to be created.

    Returns
    -------
    pathlib.Path
        Full path of the created folder.
    """
    path = Path(folder_path) / folder_name
    # Creating the folder and all non-existing parent folders.
    path.mkdir(parents=True, exist_ok=True)
    return path