def getSection(section, iraf_format=True):
  """Given an input string for a section in an image, it will
     return the input as a list.  

   section: An input string given a section in the image
            Set to None to return the whole image

   iraf_format: It will invert the x and y values

  """
  #return None if section is None
  if section is None:
     return None

  #remove the brackets
  section=section.replace('[','')
  section=section.replace(']','')

  #loop through the axis
  sect_list=[]
  for s in section.split(','):
      for t in s.split(':'):
          sect_list.append(int(t))

  #flip things around for use with python
  if iraf_format and len(sect_list)==4:
     return [sect_list[2]-1, sect_list[3], sect_list[0]-1, sect_list[1]]

  return sect_list