def select_trajectories(panel, items=None):
    """Select trajectories of certain items in a panel.

    Parameters
    ----------
    panel : pandas Panel
        A panel of trajectories, with time on the major axis, items denoting
        different trajectories, and features on the minor axis.

    items : iterable of strings (each string an item of the `panel`) or None
        The items of the panel to select. If None, then use all items in the
        panel.

    Returns
    -------
    items_to_trajectories : dict
        Dictionary mapping the items to their trajectories.
    """
    items_to_trajectories = {}
    if items is None:
        items = panel.items
    for item in items:
        items_to_trajectories[item] = panel.loc[item].dropna(how='all').values
    return items_to_trajectories