def get_conda_platform_from_python(py_platform):
    """
    Converts a python platform string to a corresponding conda platform

    Parameters
    ----------
    py_platform : str
        The python platform string

    Returns
    -------
    str
        The conda platform string

    """
    # Provides the conda platform mapping from conda/models/enum.py
    # Note that these are python prefixes (both 'linux2' and 'linux' from
    # python map to 'linux' in conda.)
    python_to_conda_platform_map = {
        'darwin': 'osx',
        'linux': 'linux',
        'openbsd': 'openbsd',
        'win': 'win',
        'zos': 'zos',
    }
    for k in python_to_conda_platform_map:
        if py_platform.startswith(k):
            return python_to_conda_platform_map[k]
    return None