parameters: (status, is_present)
return_statement: return attrs
docstring: Get port status attributes
docstring_summary: Get port status attributes
docstring_tokens: Get port status attributes
function: def get_status_strs(status, is_present):
      """Get port status attributes"""
  
      COLOR_RED, COLOR_GREEN, COLOR_RESET = get_colors()
      attrs = {}
      admin_status = "Enabled"
      link_status = "Up"
      present = "Present"
      speed = ""
      profileID = getattr(status, "profileID", "")
  
      if status.speedMbps:
          speed = "{}G".format(status.speedMbps // 1000)
      padding = 0
  
      color_start = COLOR_GREEN
      color_end = COLOR_RESET
      if not status.enabled:
          admin_status = "Disabled"
          speed = ""
      if not status.up:
          link_status = "Down"
          if status.enabled and is_present:
              color_start = COLOR_RED
          else:
              color_start = ""
              color_end = ""
      if is_present is None:
          present = "Unknown"
      elif not is_present:
          present = ""
  
      if color_start:
          padding = 10 - len(link_status)
      color_align = " " * padding
  
      link_status = color_start + link_status + color_end
  
      attrs["admin_status"] = admin_status
      attrs["link_status"] = link_status
      attrs["color_align"] = color_align
      attrs["present"] = present
      attrs["speed"] = speed
      attrs["profileID"] = profileID if profileID else "-"
  
      return attrs
function_tokens: def get_status_strs ( status , is_present ) : COLOR_RED , COLOR_GREEN , COLOR_RESET = get_colors ( ) attrs = { } admin_status = "Enabled" link_status = "Up" present = "Present" speed = "" profileID = getattr ( status , "profileID" , "" ) if status . speedMbps : speed = "{}G" . format ( status . speedMbps // 1000 ) padding = 0 color_start = COLOR_GREEN color_end = COLOR_RESET if not status . enabled : admin_status = "Disabled" speed = "" if not status . up : link_status = "Down" if status . enabled and is_present : color_start = COLOR_RED else : color_start = "" color_end = "" if is_present is None : present = "Unknown" elif not is_present : present = "" if color_start : padding = 10 - len ( link_status ) color_align = " " * padding link_status = color_start + link_status + color_end attrs [ "admin_status" ] = admin_status attrs [ "link_status" ] = link_status attrs [ "color_align" ] = color_align attrs [ "present" ] = present attrs [ "speed" ] = speed attrs [ "profileID" ] = profileID if profileID else "-" return attrs