def get_connect_kwargs(config):
    """Returns a dict of arguments from config accepted by pymssql.connect."""
    keys = ['timeout', 'login_timeout', 'charset', 'host', 'appname',
        'port', 'conn_properties', 'autocommit', 'tds_version']
    kwargs = {}
    for k in keys:
        try:
            kwargs[k] = getattr(config, k)
        except AttributeError:
            pass
    return kwargs
