def privileges_grant(name,
        object_name,
        object_type,
        privileges=None,
        grant_option=None,
        prepend='public',
        maintenance_db=None,
        user=None,
        host=None,
        port=None,
        password=None,
        runas=None):
    '''
    .. versionadded:: 2016.3.0

    Grant privileges on a postgres object

    CLI Example:

    .. code-block:: bash

        salt '*' postgres.privileges_grant user_name table_name table \\
        SELECT,UPDATE maintenance_db=db_name

    name
       Name of the role to which privileges should be granted

    object_name
       Name of the object on which the grant is to be performed

    object_type
       The object type, which can be one of the following:

       - table
       - sequence
       - schema
       - tablespace
       - language
       - database
       - group
       - function

    privileges
       Comma separated list of privileges to grant, from the list below:

       - INSERT
       - CREATE
       - TRUNCATE
       - CONNECT
       - TRIGGER
       - SELECT
       - USAGE
       - TEMPORARY
       - UPDATE
       - EXECUTE
       - REFERENCES
       - DELETE
       - ALL

    grant_option
        If grant_option is set to True, the recipient of the privilege can
        in turn grant it to others

    prepend
        Table and Sequence object types live under a schema so this should be
        provided if the object is not under the default `public` schema

    maintenance_db
        The database to connect to

    user
        database username if different from config or default

    password
        user password if any password for a specified user

    host
        Database host if different from config or default

    port
        Database port if different from config or default

    runas
        System user all operations should be performed on behalf of
    '''
    object_type, privileges, _privs = _mod_priv_opts(object_type, privileges)

    _validate_privileges(object_type, _privs, privileges)

    if has_privileges(name, object_name, object_type, privileges,
        prepend=prepend, maintenance_db=maintenance_db, user=user,
            host=host, port=port, password=password, runas=runas):
        log.info('The object: %s of type: %s already has privileges: %s set',
            object_name, object_type, privileges)
        return False

    _grants = ','.join(_privs)

    if object_type in ['table', 'sequence']:
        on_part = '{0}."{1}"'.format(prepend, object_name)
    elif object_type == 'function':
        on_part = '{0}'.format(object_name)
    else:
        on_part = '"{0}"'.format(object_name)

    if grant_option:
        if object_type == 'group':
            query = 'GRANT {0} TO "{1}" WITH ADMIN OPTION'.format(
                object_name, name)
        elif (object_type in ('table', 'sequence') and
                object_name.upper() == 'ALL'):
            query = 'GRANT {0} ON ALL {1}S IN SCHEMA {2} TO ' \
                    '"{3}" WITH GRANT OPTION'.format(
                _grants, object_type.upper(), prepend, name)
        else:
            query = 'GRANT {0} ON {1} {2} TO "{3}" WITH GRANT OPTION'.format(
                _grants, object_type.upper(), on_part, name)
    else:
        if object_type == 'group':
            query = 'GRANT {0} TO "{1}"'.format(object_name, name)
        elif (object_type in ('table', 'sequence') and
                object_name.upper() == 'ALL'):
            query = 'GRANT {0} ON ALL {1}S IN SCHEMA {2} TO "{3}"'.format(
                _grants, object_type.upper(), prepend, name)
        else:
            query = 'GRANT {0} ON {1} {2} TO "{3}"'.format(
                _grants, object_type.upper(), on_part, name)

    ret = _psql_prepare_and_run(['-c', query],
                                user=user,
                                host=host,
                                port=port,
                                maintenance_db=maintenance_db,
                                password=password,
                                runas=runas)

    return ret['retcode'] == 0
.. versionadded:: 2016.3.0

    Grant privileges on a postgres object

    CLI Example:

    .. code-block:: bash

        salt '*' postgres.privileges_grant user_name table_name table \\
        SELECT,UPDATE maintenance_db=db_name

    name
       Name of the role to which privileges should be granted

    object_name
       Name of the object on which the grant is to be performed

    object_type
       The object type, which can be one of the following:

       - table
       - sequence
       - schema
       - tablespace
       - language
       - database
       - group
       - function

    privileges
       Comma separated list of privileges to grant, from the list below:

       - INSERT
       - CREATE
       - TRUNCATE
       - CONNECT
       - TRIGGER
       - SELECT
       - USAGE
       - TEMPORARY
       - UPDATE
       - EXECUTE
       - REFERENCES
       - DELETE
       - ALL

    grant_option
        If grant_option is set to True, the recipient of the privilege can
        in turn grant it to others

    prepend
        Table and Sequence object types live under a schema so this should be
        provided if the object is not under the default `public` schema

    maintenance_db
        The database to connect to

    user
        database username if different from config or default

    password
        user password if any password for a specified user

    host
        Database host if different from config or default

    port
        Database port if different from config or default

    runas
        System user all operations should be performed on behalf of