def clean_input_ids(ids):
    """ Clean a received api variable ids to valid Python code

    Parameters
    ----------
    ids
        Can be a string (1 agent id), string encoded list (containing agent ids), list with agent ids, or None

    Returns
    -------
        None or list with string agent IDs

    """
    if ids is None:
        return None
    try:
        ids = eval(ids)
    except:
        pass
    if isinstance(ids, list):
        return ids
    if isinstance(ids, str):
        return [ids]
