code: def from_any(size, fraction_ref=None):
      """
      Creates Fixed unit when the first argument is a float, or a
      Fraction unit if that is a string that ends with %. The second
      argument is only meaningful when Fraction unit is created.::
  
        >>> a = Size.from_any(1.2) # => Size.Fixed(1.2)
        >>> Size.from_any("50%", a) # => Size.Fraction(0.5, a)
  
      """
      if cbook.is_numlike(size):
          return Fixed(size)
      elif isinstance(size, six.string_types):
          if size[-1] == "%":
              return Fraction(float(size[:-1]) / 100, fraction_ref)
  
      raise ValueError("Unknown format")
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import six
  import matplotlib.cbook
  from matplotlib.axes import Axes
label_desc: Use image node_id 2 for calling a global function with example usage: from_any(size, fraction_ref) and returns: Fixed, Fraction