code: def _calculateRegisterAddress( registertype, patternnumber, stepnumber = None):
      
      if stepnumber is None:
          stepnumber = 0
      
      # Argument checking
      _checkPatternNumber( patternnumber )
      _checkStepNumber( stepnumber )
      
      if not registertype in list(REGISTER_START.keys()): # To comply with both Python2 and Python3
          raise ValueError('Wrong register type: {0}. Allowed values: {1}'.format( 
              repr(registertype), repr( list(REGISTER_START.keys()) )))
  
      # Calculate register address
      address = REGISTER_START[registertype] + \
                  patternnumber * REGISTER_OFFSET_PER_PATTERN[registertype] + \
                  stepnumber * REGISTER_OFFSET_PER_STEP[registertype]
          
      return address
docs: Calculate the register address for pattern related parameters.
      
      Args:
          * registertype (string): The type of parameter, for example 'cycles'. 
            Allowed are the keys from :data:`REGISTER_START`.
          * patternnumber (int): The pattern number.
          * stepnumber (int): The step number. Use None if it not should affect the calculation.
      
      Returns:
          The register address (int).
      
      Raises:
          TypeError, ValueError