import re


def _is_valid_frequency(value: str) -> bool:
    """Returns true if the frequency passed is an instance of string, is not None, and adheres to the
    regex patterns for frequency strings.
    """
    pattern = r"^\d+[smhdwM]$"
    return isinstance(value, str) and re.match(pattern, value) is not None