"""Helpers for ALSA tools, including aplay and arecord."""


def sample_width_to_string(sample_width):
    """Convert sample width (bytes) to ALSA format string."""
    return {1: 's8', 2: 's16', 4: 's32'}[sample_width]

"""Helpers for ALSA tools, including aplay and arecord."""


def sample_width_to_string(sample_width):
    """Convert sample width (bytes) to ALSA format string."""
    return {1: 's8', 2: 's16', 4: 's32'}.get(sample_width, None)

Return None with invalid sample_width from sample_width_to_string.
Return None with invalid sample_width from sample_width_to_string.

  """Helpers for ALSA tools, including aplay and arecord."""
  
  
  def sample_width_to_string(sample_width):
      """Convert sample width (bytes) to ALSA format string."""
-     return {1: 's8', 2: 's16', 4: 's32'}[sample_width]
+     return {1: 's8', 2: 's16', 4: 's32'}.get(sample_width, None)
  
Return None with invalid sample_width from sample_width_to_string.
## Code Before:
"""Helpers for ALSA tools, including aplay and arecord."""


def sample_width_to_string(sample_width):
    """Convert sample width (bytes) to ALSA format string."""
    return {1: 's8', 2: 's16', 4: 's32'}[sample_width]

## Instruction:
Return None with invalid sample_width from sample_width_to_string.
## Code After:
"""Helpers for ALSA tools, including aplay and arecord."""


def sample_width_to_string(sample_width):
    """Convert sample width (bytes) to ALSA format string."""
    return {1: 's8', 2: 's16', 4: 's32'}.get(sample_width, None)
