import requests
from mp_api.client import MPRester

_session = requests.Session()


def get_rester(use_document_model: bool = False) -> MPRester:
    """Get an instance of MPRester with one session per worker.

    If other kwargs are needed, add these to `get_rester`

    Args:
        use_document_model (bool) : Whether to use pydantic models
    Returns:
        Instance of MPRester with one session per worker.
    """
    return MPRester(session=_session, use_document_model=use_document_model)
