def find_parameter(env, param, role=""):
    """
    Find a parameter in an environment map and return it.
    If paramter is not found return 0.

    Supports role parameters too. E.g. given the following
    inside of env, with param=CephHciOsdCount and role="",
    this function returns 3. But if role=ComputeHCI, then
    it would return 4.

      CephHciOsdCount: 3
      ComputeHCIParameters:
        CephHciOsdCount: 4
    """
    role_parameters = role + 'Parameters'
    if role_parameters in env and param in env[role_parameters]:
        return env[role_parameters][param]
    elif param in env:
        return env[param]
    return 0