def get_programs(user, program_id=None, use_catalog=False):
 if use_catalog:
  programs = [munge_catalog_program(program) for program in get_catalog_programs(user)]
 else:
  programs_config = ProgramsApiConfig.current()
  cache_key = (programs_config.CACHE_KEY if (programs_config.is_cache_enabled and (not user.is_staff)) else None)
  programs = get_edx_api_data(programs_config, user, 'programs', resource_id=program_id, cache_key=cache_key)
  if (not program_id):
   programs += [munge_catalog_program(micromaster) for micromaster in get_catalog_programs(user, type='MicroMasters')]
 return programs

def get_programs ( user , program_id = None , use_catalog = False ) : if use_catalog : programs = [ munge_catalog_program ( program ) for program in get_catalog_programs ( user ) ] else : programs_config = ProgramsApiConfig . current ( ) cache_key = ( programs_config . CACHE_KEY if ( programs_config . is_cache_enabled and ( not user . is_staff ) ) else None ) programs = get_edx_api_data ( programs_config , user , 'programs' , resource_id = program_id , cache_key = cache_key ) if ( not program_id ) : programs += [ munge_catalog_program ( micromaster ) for micromaster in get_catalog_programs ( user , type = 'MicroMasters' ) ] return programs
retrieve marketable programs from the catalog service .