def get_devices_dict(version, image=None, arch=None, feature=None):
    """Based on version and image, returns a dictionary containing
       the folder location and the patterns of the installation files for
       each device type

    :param version: build version, e.g. 6.2.3-623
    :param image: optional, 'Autotest' or 'Restore', required for M3, M4, S3 (FMC and Sensor)
    :param arch: optional, device architecture, required for S3 (FMC and Sensor) - e.g x86_64
    :param feature: optional, whether the build is on a feature branch (e.g. MARIADB)
    :return: a dictionary
    """

    if feature is None:
        feature = ''
    else:
        feature = ".{}".format(feature)

    devices = {
        'kenton': {'patterns': ['ftd-[\d\.-]+{}.pkg'.format(feature), 'ftd-boot-[\d.]+lfbff'],
                   'subdir': ['installers', 'installers/doNotRelease'],
                   },
        'saleen': {'patterns': ['ftd-[\d\.-]+{}.pkg'.format(feature), 'ftd-boot-[\d.]+cdisk'],
                   'subdir': ['installers', 'installers/doNotRelease'],
                   },
        'elektra': {'patterns': ['asasfr-sys-[\d.-]+.pkg', 'asasfr-5500x-boot-[\d.-]+img'],
                    'subdir': ['installers', 'installers/doNotRelease'],
                    },
        'm3': {'patterns': ['Sourcefire_Defense_Center_S3-{}{}-{}.iso'.format(version, feature, image),
                            'Sourcefire_Defense_Center-{}{}-{}.iso'.format(version, feature, image),
                            'Cisco_Firepower_Mgmt_Center-{}{}-{}.iso'.format(version, feature, image)],
               'subdir': ['iso', 'iso/doNotRelease'],
               },
        'm4': {'patterns': ['Sourcefire_Defense_Center_M4-{}{}-{}.iso'.format(version, feature, image),
                            'Cisco_Firepower_Mgmt_Center-{}{}-{}.iso'.format(version, feature, image),
                            'Sourcefire_Defense_Center-{}{}-{}.iso'.format(version, feature, image)],
               'subdir': ['iso', 'iso/doNotRelease'],
               },
        'm5': {'patterns': ['Sourcefire_Defense_Center-{}{}-{}.iso'.format(version, feature, image),
                            'Cisco_Firepower_Mgmt_Center-{}{}-{}.iso'.format(version, feature, image)],
               'subdir': ['iso', 'iso/doNotRelease'],
               },
        's3fmc': {'patterns': ['Sourcefire_Defense_Center_S3-{}{}-{}.iso'.format(version, feature, image),
                               'Cisco_Firepower_Mgmt_Center-{}{}-{}.iso'.format(version, feature, image)],
                  'subdir': ['iso', 'iso/doNotRelease'],
                  'boot_images': {'os/{}/boot'.format(arch): 'bzImage.*',
                                  'os/{}/ramdisks'.format(arch): 'usb-ramdisk*'}
                  },
        's3': {'patterns': ['Sourcefire_3D_Device_S3-{}{}-{}.iso'.format(version, feature, image),
                            'Cisco_Firepower_NGIPS_Appliance-{}{}-{}.iso'.format(version, feature, image)],
               'subdir': ['iso', 'iso/doNotRelease'],
               'boot_images': {'os/{}/boot'.format(arch): 'bzImage.*',
                               'os/{}/ramdisks'.format(arch): 'usb-ramdisk*'}
               },
        'kp': {'patterns': ['cisco-ftd-fp2k[\d.-]+[a-zA-Z]{3}', 'fxos-k8-fp2k-lfbff[\w.-]+[a-zA-Z]{3}',
                            'fxos-k8-lfbff[\w.-]+[a-zA-Z]{3}'],
               'subdir': ['installers', 'installers/doNotRelease'],
               },
        'ssp': {'patterns': ['cisco-ftd[\d.-]+[a-zA-Z]{3}.csp'],
                'subdir': ['installers', 'installers/doNotRelease'],
                }
    }
    return devices