def inst_dictionary(instrument_name, hostname_prefix="NDX", hostname=None, pv_prefix=None, is_scheduled=True, groups=None):
    """
    Generate the instrument dictionary for the instrument list
    Args:
        instrument_name: instrument name
        hostname_prefix: prefix for hostname (defaults to NDX)
        hostname: whole host name overrides prefix, defaults to hostname_prefix + instrument name
        pv_prefix: the pv prefeix; default to IN:instrument_name
        is_scheduled: whether the instrument has scheduled users and so should have user details written to it; default to True
        groups (List[str]): which science groups (e.g. SANS, MUONS) this instrument is in. Defaults to empty list

    Returns: dictionary for instrument

    """
    if hostname is not None:
        hostname_to_use = hostname
    else:
        hostname_to_use = hostname_prefix + instrument_name
    if pv_prefix is not None:
        pv_prefix_to_use = pv_prefix
    else:
        pv_prefix_to_use = "IN:{0}:".format(instrument_name)
        
    if groups is None:
        groups_to_use = []
    else:
        groups_to_use = groups
        
    return {"name": instrument_name,
            "hostName": hostname_to_use,
            "pvPrefix": pv_prefix_to_use,
            "isScheduled": is_scheduled,
            "groups": groups_to_use,
            }