'Construct the absolute path for accessing the object identified by `obj.id`.
:type base_dir: string
:param base_dir: A key in self.extra_dirs corresponding to the base
directory in which this object should be created, or
None to specify the default directory.
:type dir_only: boolean
:param dir_only: If True, check only the path where the file
identified by `obj` should be located, not the
dataset itself. This option applies to `extra_dir`
argument as well.
:type extra_dir: string
:param extra_dir: Append the value of this parameter to the expected
path used to access the object identified by `obj` (e.g.,
/files/000/<extra_dir>/dataset_10.dat).
:type alt_name: string
:param alt_name: Use this name as the alternative name for the returned
dataset rather than the default.
:type old_style: boolean
param old_style: This option is used for backward compatibility. If
`True` then the composed directory structure does not include a
hash id (e.g., /files/dataset_10.dat (old) vs.
/files/000/dataset_10.dat (new))'

def _construct_path(self, obj, old_style=False, base_dir=None, dir_only=False, extra_dir=None, extra_dir_at_root=False, alt_name=None, obj_dir=False, **kwargs):

    base = os.path.abspath(self.extra_dirs.get(base_dir, self.file_path))
    if (extra_dir and (extra_dir != os.path.normpath(extra_dir))):
        log.warning('extra_dir    is    not    normalized:    %s', extra_dir)
        raise ObjectInvalid('The    requested    object    is    invalid')
    if (alt_name and (not safe_relpath(alt_name))):
        log.warning('alt_name    would    locate    path    outside    dir:    %s', alt_name)
        raise ObjectInvalid('The    requested    object    is    invalid')
    if old_style:
        if (extra_dir is not None):
            path = os.path.join(base, extra_dir)
        else:
            path = base
    else:
        rel_path = os.path.join(*directory_hash_id(obj.id))
        if obj_dir:
            rel_path = os.path.join(rel_path, str(obj.id))
        if (extra_dir is not None):
            if extra_dir_at_root:
                rel_path = os.path.join(extra_dir, rel_path)
            else:
                rel_path = os.path.join(rel_path, extra_dir)
        path = os.path.join(base, rel_path)
    if (not dir_only):
        path = os.path.join(path, (alt_name if alt_name else ('dataset_%s.dat' % obj.id)))
    return os.path.abspath(path)
