Changes file mode permissions.

      >>> if chmod('/tmp/one', 0755):
      ...     print('OK')
      OK

    NOTE: The precending ``0`` is required when using a numerical mode.

def chmod(path, mode=None, user=None, group=None, other=None, recursive=False):
    """Changes file mode permissions.

      >>> if chmod('/tmp/one', 0755):
      ...     print('OK')
      OK

    NOTE: The precending ``0`` is required when using a numerical mode.
    """
    successful = True
    mode = _ops_mode(mode)
    if user is not None:
        mode.user = user
    if group is not None:
        mode.group = group
    if other is not None:
        mode.other = other
    if recursive:
        for p in find(path, no_peek=True):
            successful = _chmod(p, mode) and successful
    else:
        successful = _chmod(path, mode)
    return successful