code: def parse(ds_str, sym):
      """Parses a single datashape from a string.
  
      Parameters
      ----------
      ds_str : string
          The datashape string to parse.
      sym : TypeSymbolTable
          The symbol tables of dimensions, dtypes, and type constructors for each.
  
      """
      dsp = DataShapeParser(ds_str, sym)
      ds = dsp.parse_datashape()
      # If no datashape could be found
      if ds is None:
          dsp.raise_error("Invalid datashape")
  
      # Make sure there's no garbage at the end
      if dsp.pos != dsp.end_pos:
          dsp.raise_error("Unexpected token in datashape")
      return ds
  
imports: from __future__ import absolute_import, division, print_function
  from .None import lexer, error
  from .None import coretypes
label_desc: Use image node_id 1 for calling a global function with example usage: parse(ds_str, sym) and returns: ds