import requests


def allen_dataset_info(dataset_id):
    """Extract dataset info from Allen API.

    Parameters
    ----------
    dataset_id: int or str
        Dataset ID from Allen Brain API

    Returns
    -------
    dataset_info: dict
        Dictionary from Allen Brain containing
        some metadata for the given dataset.
    """
    url = "http://api.brain-map.org/api/v2/data/query.json?"
    url += f"criteria=model::SectionDataSet,rma::criteria,[id$eq{dataset_id}]"
    r = requests.get(url)
    raw = r.json()
    dataset_info = raw["msg"][0]
    return dataset_info