Read credentials from configfile.

def config_cred(config, providers):
    """Read credentials from configfile."""
    expected = ['aws', 'azure', 'gcp', 'alicloud']
    cred = {}
    to_remove = []
    for item in providers:
        if any(item.startswith(itemb) for itemb in expected):
            try:
                cred[item] = dict(list(config[item].items()))
            except KeyError as e:
                print("No credentials section in config file for {} -"
                      " provider will be skipped.".format(e))
                to_remove.append(item)
        else:
            print("Unsupported provider: '{}' listed in config - ignoring"
                  .format(item))
            to_remove.append(item)
    return cred, to_remove