def configure(screen_name=None, config_file=None, app=None, **kwargs):
<EOL>dirs = kwargs.pop('<STR_LIT>', None)<EOL>bases = kwargs.pop('<STR_LIT>', None)<EOL>file_config = {}<EOL>if config_file is not False:<EOL><INDENT>config_file = find_file(config_file, dirs, bases)<EOL>file_config = parse(config_file)<EOL><DEDENT>config = {k: v for k, v in file_config.items() if k not in ('<STR_LIT>', '<STR_LIT>')}<EOL>user_conf = file_config.get('<STR_LIT>', {}).get(screen_name, {})<EOL>app = app or user_conf.get('<STR_LIT>')<EOL>app_conf = file_config.get('<STR_LIT>', {}).get(app, {})<EOL>config.update(app_conf)<EOL>config.update(user_conf)<EOL>config.update({k: v for k, v in kwargs.items() if v is not None})<EOL>return config<EOL>
Set up a config dictionary using a bots.yaml config file and optional keyword args.

Args:
    screen_name (str): screen_name of user to search for in config file
    config_file (str): Path to read for the config file
    app (str): Name of the app to look for in the config file. Defaults to the one set in users.{screen_name}.
    default_directories (str): Directories to read for the bots.yaml/json file. Defaults to CONFIG_DIRS.
    default_bases (str): File names to look for in the directories. Defaults to CONFIG_BASES.