def get_modes(name):
    """Extract userpatch modes."""
    has_modes = name.find(': !')
    mode_string = ''
    if has_modes > -1:
        mode_string = name[has_modes + 3:]
        name = name[:has_modes]
    modes = {
        'direct_placement': 'P' in mode_string,
        'effect_quantity': 'C' in mode_string,
        'guard_state': 'G' in mode_string,
        'fixed_positions': 'F' in mode_string
    }
    return name, modes