code: def _file_to_abs(x, dnames, makedir=False):
      
      if x is None or os.path.isabs(x):
          return x
      elif isinstance(x, six.string_types) and objectstore.is_remote(x):
          return x
      elif isinstance(x, six.string_types) and x.lower() == "none":
          return None
      else:
          for dname in dnames:
              if dname:
                  normx = os.path.normpath(os.path.join(dname, x))
                  if os.path.exists(normx):
                      return normx
                  elif makedir:
                      utils.safe_makedir(normx)
                      return normx
          raise ValueError("Did not find input file %s in %s" % (x, dnames))
docs: Make a file absolute using the supplied base directory choices.