code: def median(xs, sort=True):
      """Returns the median of an unsorted or sorted numeric vector.
  
      @param xs: the vector itself.
      @param sort: whether to sort the vector. If you know that the vector is
        sorted already, pass C{False} here.
      @return: the median, which will always be a float, even if the vector
        contained integers originally.
      """
      if sort:
          xs = sorted(xs)
  
      mid = int(len(xs) / 2)
      if 2 * mid == len(xs):
          return float(xs[mid - 1] + xs[mid]) / 2
      else:
          return float(xs[mid])
  
imports: import math
label_desc: Use image node_id 2 for calling a global function with example usage: median(xs, sort) and returns: unknown, float