def key_filter(key):
    """
    Returns a cleaned key name

    Key names retrieved via tfjson include Terraform state numbers, as well as indices.  The keys also
    may include hash marks.  This function removes both for comparison to policy YAML files.

    Args:
      key (str): a key string

    Returns:
      str: a cleaned key string or the Issue
     """
    cleaned_key = ""
    split_key = key.split('.')
    for item in split_key:
        if not item.isdigit():
            cleaned_key = cleaned_key + "{}.".format(item)

    return cleaned_key[:-1].replace("#", "")