def part_of_env(pattern, env_name):
    """Decide if pattern is part of env_name"""
    for part in pattern.split('-'):
        if part.startswith('!'):
            if part[1:] in env_name:
                return False
        elif part not in env_name:
            return False
    return True
